If the letter is available in String str3 , decrement it 's  frequency & increment the ptr2
if ( freq . ContainsKey ( str3 [ ptr2 ] ) ) if ( freq [ str3 [ ptr2 ] ] > 0 ) { freq [ str3 [ ptr2 ] ] = freq [ str3 [ ptr2 ] ] - 1 ; ptr2 ++ ; }