Problem: We will call a string obtained by arranging the characters contained in a string a in some order, an _anagram_ of a.  For example, `greenbin` is an anagram of `beginner`. As seen here, when the same character occurs multiple times, that character must be used that number of times.  Given are N strings s_1, s_2, \ldots, s_N. Each of these strings has a length of 10 and consists of lowercase English characters. Additionally, all of these strings are distinct. Find the number of pairs of integers i, j (1 \leq i < j \leq N) such that s_i is an anagram of s_j.

Submission attempts (in order):
N = int(input())
lst = []
count = 0
st = []

for i in range(N):
  if i==0:
    in_pu = input()
    l = list(in_pu)
    lst.append(in_pu)
    st.append(set(l))
    continue
    
  in_pu = input()
  l = list(in_pu)
  lst.append(list(in_pu))
  
  if set(l) in st:
    count = count + 1 
print(count+len(list(set(lst))))

N = int(input())
lst = []
count = 0
st = []

for i in range(N):
  if i==0:
    in_pu = input()
    l = list(in_pu)
    lst.append(in_pu)
    st.append(set(l))
    continue
    
  in_pu = input()
  l = list(in_pu)
  lst.append(list(in_pu))
  
  if set(l) in st:
    count = count + 1 
print(count+1)

N = int(input())

lst = []

for i in range(N):
    lst.append("".join(sorted(list(input()))))


d={}
count = 0

print(lst)

for i in lst:
  if not i in d:
    d[i] = 0
    continue
  else:
      if d[i] == 0:
        d[i] = d[i] + 2
        count = count + 2
      else:
        d[i] = d[i] + 1
        count = count + 1
print(count)


N = int(input())

lst = []

for i in range(N):
    lst.append("".join(sorted(list(input()))))


d={}
count = 0

print(lst)

for i in lst:
  if not i in d:
    d[i] = 1
    continue
  else:
    d[i] = d[i] + 1
    count = count + d[i]-1


print(count)


N = int(input())

list = []

for i in range(N):
  list.append(list(input().sort()))
  
dct = {}
count = 0
for i in list:
  if i in dct:
    dct[i] = 1
    count = count + 1
    continue
  else:
    dct[i] = dct + 1
    count = count + 1
print(count)



N = int(input())

lst = []

for i in range(N):
    lst.append("".join(sorted(list(input()))))


d={}
count = 0

print(lst)

for i in lst:
  if not i in d:
    d[i] = 1
    continue
  else:
    d[i] = d[i] + 1
    coutn = count + d[i]-1


print(count)


N = int(input())

lst = []

for i in range(N):
    lst.append("".join(sorted(list(input()))))


d={}
count = 0

print(lst)

for i in lst:
  if not i in d:
    d[i] = 0
    continue
  else:
      if d[i] == 0:
        d[i] = d[i] + 1
        count = count + 1
      else:
        d[i] = d[i] + 1
        count = count + 1
print(count)


N = int(input())
lst = []
for i in range(N):
  #in_pu = input()
  #l = list(in_pu)
  lst.append(list(input()))
count = 0
index = 0
s = list(map(set, lst))

for i in range(len(lst)):
  i_set = set(lst[i])
  if i_set in s[0:i]+s[i+1:len(s)]:
    count = count + 1
    
print(count)

N = int(input())
lst = []
count = 0
st = []

for i in range(N):
  if i==0:
  	in_pu = input()
  	l = list(in_pu)
  	lst.append(list(input()))
    st.append(set(l))
    continue
    
  in_pu = input()
  l = list(in_pu)
  lst.append(list(input()))
  
  if set(l) in st:
    count = count + 1
print(count)


N = int(input())

lst = []

for i in range(N):
    lst.append("".join(sorted(list(input()))))


d={}
count = 0

for i in lst:
  if not i in d:
    d[i] = 1
    continue
  else:
    d[i] = d[i] + 1
    count = count + d[i]-1


print(count)


Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Accepted