This question is quite simple. we do not even use the hash table, cause there just would be two distinct characters in the result string.
So we just need to use two integer to record the number for each character appears, and to record the characters