Task: | Sanalista |
Sender: | Jiahao |
Submission time: | 2020-09-28 19:59:23 +0300 |
Language: | Java |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.18 s | details |
#2 | RUNTIME ERROR | 0.18 s | details |
#3 | RUNTIME ERROR | 0.18 s | details |
Code
import java.util.ArrayList; import java.util.Scanner; import java.util.HashMap; public class Sanalista { public static void main(String[] args) { Scanner lukija = new Scanner(System.in); ArrayList<String> sanat = new ArrayList<>(); int n = Integer.valueOf(lukija.nextLine()); for (int i = 0; i < n; i++) { String syote = lukija.nextLine(); if (syote.length() % 2 == 0) { sanat.add(syote); } } for (int i = 0; i < sanat.size(); i++) { HashMap<Character, Integer> kirjaimet = new HashMap<>(); String sana = sanat.get(i); for (int k = 0; k < sana.length(); k++) { char kirjain = sana.charAt(k); if (!(kirjaimet.containsKey(kirjain))) { kirjaimet.put(kirjain, 1); } else { kirjaimet.put(kirjain, 2); } } for (Integer lkm : kirjaimet.values()) { if (lkm % 2 != 0) { sanat.remove(i); } } } System.out.println(sanat.size()); } }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
1000 korvata sopimusaika nuhatartunta korttiautomaatti ... |
correct output |
---|
15 |
user output |
---|
87 |
Test 2
Verdict: RUNTIME ERROR
input |
---|
1000 pub hansikaslokero erikoisvalmisteinen unijukka ... |
correct output |
---|
42 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 94 out of bounds for...
Test 3
Verdict: RUNTIME ERROR
input |
---|
1000 haapalastu toipumisaika mustalaiskieli taidelainaamo ... |
correct output |
---|
70 |
user output |
---|
(empty) |
Error:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 103 out of bounds fo...