Task: | Sanalista |
Sender: | jmarttinen |
Submission time: | 2020-09-28 11:11:39 +0300 |
Language: | Python3 (CPython3) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.03 s | details |
#2 | ACCEPTED | 0.03 s | details |
#3 | ACCEPTED | 0.04 s | details |
Code
# Author: Jussi Marttinen # Last edited: 2020/09/28 # My solution for Datatähti 2020 # counts letters from collections import Counter # Gets the inputs n = int(input()) words = [] for _ in range(n): words.append(input()) # how many words fill the quota accepted = 0 for w in words: # individual letter counts in a dict_values object letter_counts = dict(Counter(w)).values() # list containing parity of every letter # inverted because then all() is easier to use inverted_parities = list(map(lambda x: not (x % 2), letter_counts)) # all(inverted_parities) is 1 if all elements are 1 (so all counts are even) accepted += all(inverted_parities) print(accepted)
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 |