| Task: | Sanalista |
| Sender: | Sartec |
| Submission time: | 2020-10-01 19:19:01 +0300 |
| Language: | Python2 (CPython2) |
| Status: | READY |
| Result: | 100 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 100 |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.02 s | details |
| #2 | ACCEPTED | 0.02 s | details |
| #3 | ACCEPTED | 0.02 s | details |
Code
from string import printable
numberOfWords = input("")
def count_occurrences(charachter, word):
return word.count(charachter)
if numberOfWords <= 1000:
words = []
x = 0
while True:
word = raw_input("")
if any(not c.isalnum() for c in word):
print("Word cannot contain special charachters")
break
if len(word) > 30:
print("Too long word")
break
words.append(word)
x+=1
if x==numberOfWords:
break
wordsWithEqualCharachters = []
for word in words:
charachters = []
isWordEligible = False
for i, c in enumerate(word):
if count_occurrences(c, word) % 2 == 0:
isWordEligible = True
else:
isWordEligible = False
break
if isWordEligible:
wordsWithEqualCharachters.append(word)
print(len(wordsWithEqualCharachters))
else:
print("1000 is the maximum number of words")
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 |
