get the K - th letter
for i in range ( N - 1 , - 1 , - 1 ) : NEW_LINE INDENT K %= size NEW_LINE if K == 0 and S [ i ] . isalpha ( ) : NEW_LINE INDENT return S [ i ] NEW_LINE DEDENT if S [ i ] . isdigit ( ) : NEW_LINE INDENT size = size // int ( S [ i ] ) NEW_LINE DEDENT else : NEW_LINE INDENT size -= 1 NEW_LINE DEDENT DEDENT