Set found variable to false whenever we find whitespace , meaning that encoded character for new word is not found
if ( str [ i ] == ' ▁ ' ) { found = false ; continue ; } if ( ! found ) { if ( str [ i ] >= ' A ' && str [ i ] <= ' Z ' ) { res += str [ i ] + 32 ; found = true ; } else if ( str [ i ] >= ' a ' && str [ i ] <= ' z ' ) { res += str [ i ] ; found = true ; } } } return res ; }