Task: | Sanalista |
Sender: | anton7r |
Submission time: | 2020-10-09 21:29:38 +0300 |
Language: | Java |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.10 s | details |
#2 | WRONG ANSWER | 0.10 s | details |
#3 | WRONG ANSWER | 0.10 s | details |
Code
import java.io.*; import java.util.HashMap; import java.util.Map; public class Main { public static void main(String[] args) { // write your code here int rivienMaara; String merkkijono; int pituus; int parilliset = 0; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); try { rivienMaara = Integer.parseInt(br.readLine()); for (int i = 0; i < rivienMaara; i++) { merkkijono = br.readLine().trim(); //merkkijono.chars() pituus = merkkijono.length(); if(pituus % 2 == 0) { Map<Character, Integer> merkkienMaarat = new HashMap<>(); for (int j = 0; j < pituus; j++) { final char merkki = merkkijono.charAt(j); Integer merkinMaara = merkkienMaarat.get(merkki); if(merkinMaara == null) { merkinMaara = 0; } merkkienMaarat.put(merkki, merkinMaara + 1); } for (Character k : merkkienMaarat.keySet()) { if(merkkienMaarat.get(k) % 2 != 0) { break; } } parilliset++; } } System.out.println(parilliset); } catch (IOException ioe) { System.out.println(ioe); } } }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
1000 korvata sopimusaika nuhatartunta korttiautomaatti ... |
correct output |
---|
15 |
user output |
---|
504 |
Test 2
Verdict: WRONG ANSWER
input |
---|
1000 pub hansikaslokero erikoisvalmisteinen unijukka ... |
correct output |
---|
42 |
user output |
---|
504 |
Test 3
Verdict: WRONG ANSWER
input |
---|
1000 haapalastu toipumisaika mustalaiskieli taidelainaamo ... |
correct output |
---|
70 |
user output |
---|
552 |