Map to map characters to real values
Dictionary < char , int > mp = new Dictionary < char , int > ( ) ; for ( int i = 0 ; i < DIGITS ; i ++ ) { if ( mp . ContainsKey ( CHARS [ i ] ) ) mp [ CHARS [ i ] ] = i ; else mp . Add ( CHARS [ i ] , i ) ; }