If the letter is available in string str3 , decrement it 's  frequency & increment the ptr2
if ( freq [ str3 [ ptr2 ] ] > 0 ) : NEW_LINE INDENT freq [ str3 [ ptr2 ] ] -= 1 NEW_LINE ptr2 += 1 NEW_LINE DEDENT