get the K - th letter
for ( int i = N - 1 ; i >= 0 ; -- i ) { K %= size ; if ( K == 0 && Character . isAlphabetic ( S . charAt ( i ) ) ) { return ( String ) " " + S . charAt ( i ) ; } if ( Character . isDigit ( S . charAt ( i ) ) ) { size = size / ( S . charAt ( i ) - '0' ) ; } else { size -= 1 ; } } return null ; }