
#  Problem of the day
#  
#  Given an array of strings, group anagrams together.
#  
#  Example:
#  
#                        
#    Input: ["eat", "tea", "tan", "ate", "nat", "bat"],
#    Output: 
#      [
#        ["ate","eat","tea"],
#        ["nat","tan"],
#        ["bat"]
#      ]

import json


Input = ["eat", "tea", "tan", "ate", "nat", "bat"]


dic = dict()
for a in Input:
  key = ''.join(sorted(a)) 
  if not key in dic:
    dic[key] = [a]
  else:
    dic[key].append(a)

output = list(dic.values())

print(output)


e09e9c0851ce73d6499354865621db0f7e0d5676
<mask token>

<mask token>
for a in Input:
    key = ''.join(sorted(a))
    if not key in dic:
        dic[key] = [a]
    else:
        dic[key].append(a)
<mask token>
print(output)

<mask token>
Input = ['eat', 'tea', 'tan', 'ate', 'nat', 'bat']
dic = dict()
for a in Input:
    key = ''.join(sorted(a))
    if not key in dic:
        dic[key] = [a]
    else:
        dic[key].append(a)
output = list(dic.values())
print(output)

import json
Input = ['eat', 'tea', 'tan', 'ate', 'nat', 'bat']
dic = dict()
for a in Input:
    key = ''.join(sorted(a))
    if not key in dic:
        dic[key] = [a]
    else:
        dic[key].append(a)
output = list(dic.values())
print(output)


#  Problem of the day
#  
#  Given an array of strings, group anagrams together.
#  
#  Example:
#  
#                        
#    Input: ["eat", "tea", "tan", "ate", "nat", "bat"],
#    Output: 
#      [
#        ["ate","eat","tea"],
#        ["nat","tan"],
#        ["bat"]
#      ]

import json


Input = ["eat", "tea", "tan", "ate", "nat", "bat"]


dic = dict()
for a in Input:
  key = ''.join(sorted(a)) 
  if not key in dic:
    dic[key] = [a]
  else:
    dic[key].append(a)

output = list(dic.values())

print(output)

