CSES - Datatähti 2021 alku - Results
Submission details
Task:Sanalista
Sender:Zendium
Submission time:2020-10-01 17:56:16 +0300
Language:Java
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.57 sdetails
#2ACCEPTED0.65 sdetails
#3ACCEPTED0.45 sdetails

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