Iterate over the s to find the occurence of each Character
foreach ( char i in s ) { if ( Dict . ContainsKey ( i ) ) { Dict [ i ] ++ ; } else { Dict [ i ] = 1 ; } } int minfrequency = Int32 . MaxValue ;