CSES - Datatähti 2021 alku - Results
Submission details
Task:Sanalista
Sender:jaaskelainen
Submission time:2020-09-28 10:58:09 +0300
Language:Python3 (CPython3)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.03 sdetails
#2ACCEPTED0.03 sdetails
#3ACCEPTED0.03 sdetails

Code

#!/usr/bin/python

# Datatähti 2021 tehtävä "Sanalista"
# A little messy but it works
# Luka Jääskeläinen 2020


inp = input()
wordlist = []
equalChars = 0

# Get the words
for c in range(int(inp)):
    wordlist.append(input())

# Analyse the words
for word in wordlist:
    letters = {}
    dupLetters = {}

    # Get list of letters and amount of them
    for c in word:
        if c not in letters:
            letters[c] = 0
        letters[c] += 1
    
    # Check for all the letters that are divisible by 2
    for l in letters:
        if(letters[l] % 2 == 0):
            dupLetters[l] = letters[l]
            
    # Count all the words with equal letters
    if(letters == dupLetters):
        equalChars += 1

# Print the result :-)
print(equalChars)    

Test details

Test 1

Verdict: ACCEPTED

input
1000
korvata
sopimusaika
nuhatartunta
korttiautomaatti
...

correct output
15

user output
15

Test 2

Verdict: ACCEPTED

input
1000
pub
hansikaslokero
erikoisvalmisteinen
unijukka
...

correct output
42

user output
42

Test 3

Verdict: ACCEPTED

input
1000
haapalastu
toipumisaika
mustalaiskieli
taidelainaamo
...

correct output
70

user output
70