Caso # | Resultado | Tiempo | Memoria |
---|---|---|---|
#1 |
Correcto
|
0.125 s | 13 KBi |
#2 |
Correcto
|
0.142 s | 14 KBi |
#3 |
Correcto
|
0.142 s | 12 KBi |
#4 |
Correcto
|
0.158 s | 15 KBi |
#5 |
Correcto
|
0.133 s | 13 KBi |
#6 |
Correcto
|
0.119 s | 25 KBi |
#7 |
Correcto
|
0.16 s | 13 KBi |
#8 |
Correcto
|
0.13 s | 13 KBi |
#9 |
Correcto
|
0.121 s | 12 KBi |
#10 |
Correcto
|
0.253 s | 14 KBi |
#11 |
Correcto
|
0.267 s | 14 KBi |
#12 |
Correcto
|
0.179 s | 14 KBi |
import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static void main(String args[]){ Scanner entrada = new Scanner(System.in); String string = entrada.nextLine(); Pattern pattern = null; Matcher matcher = null; int sum,sw; sw=0; for(int i=0; i < string.length();i++) { sum=0; String regex = ""; regex = string.substring(i,i+1) + "?"; pattern = Pattern.compile(regex); matcher = pattern.matcher(string); while (matcher.find()) { sum+=matcher.group(0).length(); } if(sum > 1) { sw=1; break; } } System.out.println((sw!=0)?"yes":"no"); } }