Submission details
Task:Anagrams
Sender:TuomoPera
Submission time:2020-09-26 13:38:39 +0300
Language:Python3 (PyPy3)
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.33 sdetails
#2ACCEPTED1.30 sdetails
#3ACCEPTED0.47 sdetails
#4ACCEPTED1.26 sdetails
#5ACCEPTED1.10 sdetails
#6ACCEPTED1.10 sdetails
#7ACCEPTED0.05 sdetails
#8ACCEPTED0.05 sdetails
#9ACCEPTED0.05 sdetails

Code

words = {}

num = int(input())
for i in range(num):
    word = input()
    sortedWord = "".join(sorted(word))
    if sortedWord in words:
        words[sortedWord].append(word)
    else:
        words[sortedWord] = [word]
    
ttl = 0
for key in words.keys():
    if len(words[key]) > 1:
        ttl += 1
print(ttl)

for key in words.keys():
    if len(words[key]) > 1:
        print(len(words[key]))
        for word in words[key]:
            print(word)

Test details

Test 1

Verdict: ACCEPTED

input
68760
aakkonen
aakkosellinen
aakkosellisesti
aakkosellisuus
...

correct output
3076
2
haaraantua
raahaantua
2
...

user output
3076
2
aakkosellinen
kaaoksellinen
2
...
Truncated

Test 2

Verdict: ACCEPTED

input
370099
a
aa
aaa
aah
...

correct output
30178
2
basiparachromatin
marsipobranchiata
2
...

user output
30178
2
aah
aha
2
...
Truncated

Test 3

Verdict: ACCEPTED

input
100000
cnhmuewgnum
dxkmhzhetnmxadtcy
hfjqwavsiguwpludsketibe
xwxolrmvkz
...

correct output
0

user output
0

Test 4

Verdict: ACCEPTED

input
400000
vlcsa
eltwde
wdcwwkubs
tmuxbirj
...

correct output
0

user output
0

Test 5

Verdict: ACCEPTED

input
400000
ebhfigdacjlk
aecfdijlhkgb
jfekhbidacgl
cehajbidfklg
...

correct output
1
400000
abcdeighjlfk
abcdeiglhfjk
abcdfkilejgh
...

user output
1
400000
ebhfigdacjlk
aecfdijlhkgb
jfekhbidacgl
...
Truncated

Test 6

Verdict: ACCEPTED

input
400000
cbaabghadefb
hbbgfaeabdac
abaedcbgfbha
hcfadbbbeaag
...

correct output
1
400000
aaabbbcfegdh
aaabbbcfghed
aaabbbdcgfhe
...

user output
1
400000
cbaabghadefb
hbbgfaeabdac
abaedcbgfbha
...
Truncated

Test 7

Verdict: ACCEPTED

input
1
a

correct output
0

user output
0

Test 8

Verdict: ACCEPTED

input
2
ab
ba

correct output
1
2
ab
ba

user output
1
2
ab
ba

Test 9

Verdict: ACCEPTED

input
2
aa
ab

correct output
0

user output
0