Task: | Sanalista |
Sender: | Jiahao |
Submission time: | 2020-09-28 19:57:47 +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 | WRONG ANSWER | 0.18 s | details |
#3 | WRONG ANSWER | 0.19 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); } } if (kirjaimet.values().contains(1)) { 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 |
---|
256 |
Test 2
Verdict: WRONG ANSWER
input |
---|
1000 pub hansikaslokero erikoisvalmisteinen unijukka ... |
correct output |
---|
42 |
user output |
---|
261 |
Test 3
Verdict: WRONG ANSWER
input |
---|
1000 haapalastu toipumisaika mustalaiskieli taidelainaamo ... |
correct output |
---|
70 |
user output |
---|
299 |