If str [ i ] is between a and z and i is the last occurence in str
if ( ( str [ i ] >= ' a ' and str [ i ] <= ' z ' ) and small [ ord ( str [ i ] ) - 97 ] == i ) : NEW_LINE INDENT occ = ord ( str [ i ] ) - 96 NEW_LINE while ( occ > 0 ) : NEW_LINE INDENT res += str [ i ] NEW_LINE occ -= 1 NEW_LINE DEDENT DEDENT