Set found variable to false whenever we find whitespace , meaning that encoded character for new word is not found
if character == ' ▁ ' : NEW_LINE INDENT found = False NEW_LINE continue NEW_LINE DEDENT if not found : NEW_LINE INDENT if character >= ' A ' and character <= ' Z ' or character >= ' a ' and character <= ' z ' : NEW_LINE INDENT res += character NEW_LINE found = True NEW_LINE DEDENT DEDENT return res . lower ( ) NEW_LINE