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