[Anagrams] Reduce memory cost

Reduce memory cost by changing `map<string, string>` to `map<string, int>`.