Minimum String Length After Removing Substrings In Bash