█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 2023

Problema 0x5c - Decir si hay una letra repetida

  • Autor: aebernalmunoz
  • Fecha: 2020-11-17 16:01:32 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Correcto
0.159 s 16 KBi
#2
Correcto
0.126 s 13 KBi
#3
Correcto
0.137 s 13 KBi
#4
Correcto
0.145 s 13 KBi
#5
Correcto
0.152 s 13 KBi
#6
Correcto
0.155 s 13 KBi
#7
Correcto
0.144 s 13 KBi
#8
Correcto
0.143 s 13 KBi
#9
Correcto
0.173 s 13 KBi
#10
Correcto
0.147 s 16 KBi
#11
Correcto
0.153 s 13 KBi
#12
Correcto
0.145 s 13 KBi
Puntos totales: 100 / 100

Código

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

class Main{
	public static void main(String[] args) {
		Set<Character> set = new HashSet<Character>();
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		String s = sc.nextLine();
		boolean isRepeated = false;
		for (int i = 0; i < s.length(); i++) {
			if (!set.add(s.charAt(i))) {
				isRepeated = true;
			}
		}
		System.out.println(isRepeated ? "yes" : "no");

	}

}