If str [ i ] is between 0 and 9 and i is the last occurence in str
elif ( ( str [ i ] >= '0' and str [ i ] <= '9' ) and num [ ord ( str [ i ] ) - 48 ] == i ) : NEW_LINE INDENT occ = ord ( str [ i ] ) - 48 NEW_LINE while ( occ > 0 ) : NEW_LINE INDENT res += str [ i ] NEW_LINE occ -= 1 NEW_LINE DEDENT DEDENT else : NEW_LINE INDENT res += str [ i ] NEW_LINE DEDENT