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

Envío 4247

Problema 0x5c - Decir si hay una letra repetida

  • Autor: andres0608
  • Fecha: 2021-05-30 04:54:57 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void main(String args[]){
              ^
Main.java:4: error: class, interface, or enum expected
		        Pattern pattern = null;
		        ^
Main.java:5: error: class, interface, or enum expected
		        Matcher matcher = null;
		        ^
Main.java:6: error: class, interface, or enum expected
		        int sum;
		        ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	             ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	                                 ^
Main.java:9: error: class, interface, or enum expected
		    		String regex = "";
		    		^
Main.java:10: error: class, interface, or enum expected
		    		regex = string.substring(i,i+1) + "?";
		    		^
Main.java:11: error: class, interface, or enum expected
		    		pattern = Pattern.compile(regex);
		    		^
Main.java:12: error: class, interface, or enum expected
		    		matcher = pattern.matcher(string);
		    		^
Main.java:14: error: class, interface, or enum expected
		    		while (matcher.find()) {
		    		^
Main.java:16: error: class, interface, or enum expected
			        }	
			        ^
Main.java:19: error: class, interface, or enum expected
		    		}
		    		^
14 errors

                    
#2
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void main(String args[]){
              ^
Main.java:4: error: class, interface, or enum expected
		        Pattern pattern = null;
		        ^
Main.java:5: error: class, interface, or enum expected
		        Matcher matcher = null;
		        ^
Main.java:6: error: class, interface, or enum expected
		        int sum;
		        ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	             ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	                                 ^
Main.java:9: error: class, interface, or enum expected
		    		String regex = "";
		    		^
Main.java:10: error: class, interface, or enum expected
		    		regex = string.substring(i,i+1) + "?";
		    		^
Main.java:11: error: class, interface, or enum expected
		    		pattern = Pattern.compile(regex);
		    		^
Main.java:12: error: class, interface, or enum expected
		    		matcher = pattern.matcher(string);
		    		^
Main.java:14: error: class, interface, or enum expected
		    		while (matcher.find()) {
		    		^
Main.java:16: error: class, interface, or enum expected
			        }	
			        ^
Main.java:19: error: class, interface, or enum expected
		    		}
		    		^
14 errors

                    
#3
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void main(String args[]){
              ^
Main.java:4: error: class, interface, or enum expected
		        Pattern pattern = null;
		        ^
Main.java:5: error: class, interface, or enum expected
		        Matcher matcher = null;
		        ^
Main.java:6: error: class, interface, or enum expected
		        int sum;
		        ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	             ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	                                 ^
Main.java:9: error: class, interface, or enum expected
		    		String regex = "";
		    		^
Main.java:10: error: class, interface, or enum expected
		    		regex = string.substring(i,i+1) + "?";
		    		^
Main.java:11: error: class, interface, or enum expected
		    		pattern = Pattern.compile(regex);
		    		^
Main.java:12: error: class, interface, or enum expected
		    		matcher = pattern.matcher(string);
		    		^
Main.java:14: error: class, interface, or enum expected
		    		while (matcher.find()) {
		    		^
Main.java:16: error: class, interface, or enum expected
			        }	
			        ^
Main.java:19: error: class, interface, or enum expected
		    		}
		    		^
14 errors

                    
#4
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void main(String args[]){
              ^
Main.java:4: error: class, interface, or enum expected
		        Pattern pattern = null;
		        ^
Main.java:5: error: class, interface, or enum expected
		        Matcher matcher = null;
		        ^
Main.java:6: error: class, interface, or enum expected
		        int sum;
		        ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	             ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	                                 ^
Main.java:9: error: class, interface, or enum expected
		    		String regex = "";
		    		^
Main.java:10: error: class, interface, or enum expected
		    		regex = string.substring(i,i+1) + "?";
		    		^
Main.java:11: error: class, interface, or enum expected
		    		pattern = Pattern.compile(regex);
		    		^
Main.java:12: error: class, interface, or enum expected
		    		matcher = pattern.matcher(string);
		    		^
Main.java:14: error: class, interface, or enum expected
		    		while (matcher.find()) {
		    		^
Main.java:16: error: class, interface, or enum expected
			        }	
			        ^
Main.java:19: error: class, interface, or enum expected
		    		}
		    		^
14 errors

                    
#5
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void main(String args[]){
              ^
Main.java:4: error: class, interface, or enum expected
		        Pattern pattern = null;
		        ^
Main.java:5: error: class, interface, or enum expected
		        Matcher matcher = null;
		        ^
Main.java:6: error: class, interface, or enum expected
		        int sum;
		        ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	             ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	                                 ^
Main.java:9: error: class, interface, or enum expected
		    		String regex = "";
		    		^
Main.java:10: error: class, interface, or enum expected
		    		regex = string.substring(i,i+1) + "?";
		    		^
Main.java:11: error: class, interface, or enum expected
		    		pattern = Pattern.compile(regex);
		    		^
Main.java:12: error: class, interface, or enum expected
		    		matcher = pattern.matcher(string);
		    		^
Main.java:14: error: class, interface, or enum expected
		    		while (matcher.find()) {
		    		^
Main.java:16: error: class, interface, or enum expected
			        }	
			        ^
Main.java:19: error: class, interface, or enum expected
		    		}
		    		^
14 errors

                    
#6
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void main(String args[]){
              ^
Main.java:4: error: class, interface, or enum expected
		        Pattern pattern = null;
		        ^
Main.java:5: error: class, interface, or enum expected
		        Matcher matcher = null;
		        ^
Main.java:6: error: class, interface, or enum expected
		        int sum;
		        ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	             ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	                                 ^
Main.java:9: error: class, interface, or enum expected
		    		String regex = "";
		    		^
Main.java:10: error: class, interface, or enum expected
		    		regex = string.substring(i,i+1) + "?";
		    		^
Main.java:11: error: class, interface, or enum expected
		    		pattern = Pattern.compile(regex);
		    		^
Main.java:12: error: class, interface, or enum expected
		    		matcher = pattern.matcher(string);
		    		^
Main.java:14: error: class, interface, or enum expected
		    		while (matcher.find()) {
		    		^
Main.java:16: error: class, interface, or enum expected
			        }	
			        ^
Main.java:19: error: class, interface, or enum expected
		    		}
		    		^
14 errors

                    
#7
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void main(String args[]){
              ^
Main.java:4: error: class, interface, or enum expected
		        Pattern pattern = null;
		        ^
Main.java:5: error: class, interface, or enum expected
		        Matcher matcher = null;
		        ^
Main.java:6: error: class, interface, or enum expected
		        int sum;
		        ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	             ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	                                 ^
Main.java:9: error: class, interface, or enum expected
		    		String regex = "";
		    		^
Main.java:10: error: class, interface, or enum expected
		    		regex = string.substring(i,i+1) + "?";
		    		^
Main.java:11: error: class, interface, or enum expected
		    		pattern = Pattern.compile(regex);
		    		^
Main.java:12: error: class, interface, or enum expected
		    		matcher = pattern.matcher(string);
		    		^
Main.java:14: error: class, interface, or enum expected
		    		while (matcher.find()) {
		    		^
Main.java:16: error: class, interface, or enum expected
			        }	
			        ^
Main.java:19: error: class, interface, or enum expected
		    		}
		    		^
14 errors

                    
#8
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void main(String args[]){
              ^
Main.java:4: error: class, interface, or enum expected
		        Pattern pattern = null;
		        ^
Main.java:5: error: class, interface, or enum expected
		        Matcher matcher = null;
		        ^
Main.java:6: error: class, interface, or enum expected
		        int sum;
		        ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	             ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	                                 ^
Main.java:9: error: class, interface, or enum expected
		    		String regex = "";
		    		^
Main.java:10: error: class, interface, or enum expected
		    		regex = string.substring(i,i+1) + "?";
		    		^
Main.java:11: error: class, interface, or enum expected
		    		pattern = Pattern.compile(regex);
		    		^
Main.java:12: error: class, interface, or enum expected
		    		matcher = pattern.matcher(string);
		    		^
Main.java:14: error: class, interface, or enum expected
		    		while (matcher.find()) {
		    		^
Main.java:16: error: class, interface, or enum expected
			        }	
			        ^
Main.java:19: error: class, interface, or enum expected
		    		}
		    		^
14 errors

                    
#9
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void main(String args[]){
              ^
Main.java:4: error: class, interface, or enum expected
		        Pattern pattern = null;
		        ^
Main.java:5: error: class, interface, or enum expected
		        Matcher matcher = null;
		        ^
Main.java:6: error: class, interface, or enum expected
		        int sum;
		        ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	             ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	                                 ^
Main.java:9: error: class, interface, or enum expected
		    		String regex = "";
		    		^
Main.java:10: error: class, interface, or enum expected
		    		regex = string.substring(i,i+1) + "?";
		    		^
Main.java:11: error: class, interface, or enum expected
		    		pattern = Pattern.compile(regex);
		    		^
Main.java:12: error: class, interface, or enum expected
		    		matcher = pattern.matcher(string);
		    		^
Main.java:14: error: class, interface, or enum expected
		    		while (matcher.find()) {
		    		^
Main.java:16: error: class, interface, or enum expected
			        }	
			        ^
Main.java:19: error: class, interface, or enum expected
		    		}
		    		^
14 errors

                    
#10
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void main(String args[]){
              ^
Main.java:4: error: class, interface, or enum expected
		        Pattern pattern = null;
		        ^
Main.java:5: error: class, interface, or enum expected
		        Matcher matcher = null;
		        ^
Main.java:6: error: class, interface, or enum expected
		        int sum;
		        ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	             ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	                                 ^
Main.java:9: error: class, interface, or enum expected
		    		String regex = "";
		    		^
Main.java:10: error: class, interface, or enum expected
		    		regex = string.substring(i,i+1) + "?";
		    		^
Main.java:11: error: class, interface, or enum expected
		    		pattern = Pattern.compile(regex);
		    		^
Main.java:12: error: class, interface, or enum expected
		    		matcher = pattern.matcher(string);
		    		^
Main.java:14: error: class, interface, or enum expected
		    		while (matcher.find()) {
		    		^
Main.java:16: error: class, interface, or enum expected
			        }	
			        ^
Main.java:19: error: class, interface, or enum expected
		    		}
		    		^
14 errors

                    
#11
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void main(String args[]){
              ^
Main.java:4: error: class, interface, or enum expected
		        Pattern pattern = null;
		        ^
Main.java:5: error: class, interface, or enum expected
		        Matcher matcher = null;
		        ^
Main.java:6: error: class, interface, or enum expected
		        int sum;
		        ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	             ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	                                 ^
Main.java:9: error: class, interface, or enum expected
		    		String regex = "";
		    		^
Main.java:10: error: class, interface, or enum expected
		    		regex = string.substring(i,i+1) + "?";
		    		^
Main.java:11: error: class, interface, or enum expected
		    		pattern = Pattern.compile(regex);
		    		^
Main.java:12: error: class, interface, or enum expected
		    		matcher = pattern.matcher(string);
		    		^
Main.java:14: error: class, interface, or enum expected
		    		while (matcher.find()) {
		    		^
Main.java:16: error: class, interface, or enum expected
			        }	
			        ^
Main.java:19: error: class, interface, or enum expected
		    		}
		    		^
14 errors

                    
#12
Error de compilación
                      Main.java:1: error: class, interface, or enum expected
public static void main(String args[]){
              ^
Main.java:4: error: class, interface, or enum expected
		        Pattern pattern = null;
		        ^
Main.java:5: error: class, interface, or enum expected
		        Matcher matcher = null;
		        ^
Main.java:6: error: class, interface, or enum expected
		        int sum;
		        ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	             ^
Main.java:7: error: class, interface, or enum expected
		    	for(int i=0; i < string.length();i++) {
		    	                                 ^
Main.java:9: error: class, interface, or enum expected
		    		String regex = "";
		    		^
Main.java:10: error: class, interface, or enum expected
		    		regex = string.substring(i,i+1) + "?";
		    		^
Main.java:11: error: class, interface, or enum expected
		    		pattern = Pattern.compile(regex);
		    		^
Main.java:12: error: class, interface, or enum expected
		    		matcher = pattern.matcher(string);
		    		^
Main.java:14: error: class, interface, or enum expected
		    		while (matcher.find()) {
		    		^
Main.java:16: error: class, interface, or enum expected
			        }	
			        ^
Main.java:19: error: class, interface, or enum expected
		    		}
		    		^
14 errors

                    
Puntos totales: 0 / 100

Código

public static void main(String args[]){
		        
		        String string = "alvaro";	        
		        Pattern pattern = null;
		        Matcher matcher = null;
		        int sum;
		    	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) {
		    			break;
		    		}
		    	}
		    	
		    }