Task: | Sanalista |
Sender: | Zendium |
Submission time: | 2020-10-01 17:56:16 +0300 |
Language: | Java |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 100 |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.57 s | details |
#2 | ACCEPTED | 0.65 s | details |
#3 | ACCEPTED | 0.45 s | details |
Code
import java.util.ArrayList; import java.util.Scanner; public class Main { static Scanner scanner = new Scanner(System.in); public static void main(String[] args) { int length = Integer.parseInt(scanner.nextLine()); int evenWords = 0; for (int ask = 0; ask < length; ask++) { String word = scanner.nextLine(); boolean evenWord = true; ArrayList<Boolean> bools = new ArrayList<>(); for (String letter : word.split("")) { boolean evenLetter = false; int letterAmount = 0; for (String letter2 : word.split("")){ if (letter2.equals(letter)){ letterAmount++; } } if (letterAmount % 2 == 0) { evenLetter = true; } else { evenLetter = false; } bools.add(evenLetter); if (letter.equals(word.split("")[word.split("").length - 1])) { for (boolean bool : bools) { if (!bool) { evenWord = false; } } } } if (evenWord) { evenWords++; } } System.out.println(evenWords); } }
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 |