Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.12 s | 13 KBi |
#2 |
Correcto
|
0.102 s | 13 KBi |
#3 |
Correcto
|
0.107 s | 13 KBi |
#4 |
Correcto
|
0.118 s | 13 KBi |
#5 |
Correcto
|
0.112 s | 13 KBi |
#6 |
Correcto
|
0.073 s | 16 KBi |
#7 |
Correcto
|
0.093 s | 13 KBi |
#8 |
Correcto
|
0.099 s | 13 KBi |
#9 |
Correcto
|
0.121 s | 13 KBi |
#10 |
Correcto
|
0.093 s | 16 KBi |
#11 |
Correcto
|
0.106 s | 13 KBi |
#12 |
Correcto
|
0.109 s | 13 KBi |
import java.util.HashMap; import java.util.Scanner; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); HashMap<Character, Integer> map = new HashMap<>(); boolean repeated = false; String text; text = scan.nextLine(); scan.close(); for (int i = 0; i < text.length(); i++) { char current = text.charAt(i); if (!map.containsKey(current)) { map.put(current, i); } else { repeated = true; } } if (repeated) { System.out.println("yes"); } else { System.out.println("no"); } } }