Task: | Sanalista |
Sender: | iRobo |
Submission time: | 2020-10-10 14:59:49 +0300 |
Language: | Java |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.17 s | details |
#2 | ACCEPTED | 0.17 s | details |
#3 | ACCEPTED | 0.17 s | details |
Code
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int lineCount = input.nextInt(); String stringInput; int noOfSatisfyingWords = 0; for(int i = 0; i < lineCount; i++) { stringInput = input.next(); if(checkWordPairsOfLetters(stringInput)) { noOfSatisfyingWords++; } } System.out.println(noOfSatisfyingWords); } public static boolean checkWordPairsOfLetters(String word) { boolean paired = true; int[] letters = new int[27]; for(int i = 0; i < word.length(); i++) { //97 = a, 122 = z letters[(int)word.charAt(i)-97]++; } for(int i = 0; i < 27; i++) { if(letters[i] % 2 == 1) { paired = false; break; } } return paired; } }
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 |