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

Envío 4248

Problema 0x5c - Decir si hay una letra repetida

  • Autor: andres0608
  • Fecha: 2021-05-30 05:05:20 UTC (Hace más de 3 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      Main.java:8: error: cannot find symbol
		        Pattern pattern = null;
		        ^
  symbol:   class Pattern
  location: class Main
Main.java:9: error: cannot find symbol
		        Matcher matcher = null;
		        ^
  symbol:   class Matcher
  location: class Main
Main.java:16: error: cannot find symbol
		    		pattern = Pattern.compile(regex);
		    		          ^
  symbol:   variable Pattern
  location: class Main
3 errors

                    
#2
Error de compilación
                      Main.java:8: error: cannot find symbol
		        Pattern pattern = null;
		        ^
  symbol:   class Pattern
  location: class Main
Main.java:9: error: cannot find symbol
		        Matcher matcher = null;
		        ^
  symbol:   class Matcher
  location: class Main
Main.java:16: error: cannot find symbol
		    		pattern = Pattern.compile(regex);
		    		          ^
  symbol:   variable Pattern
  location: class Main
3 errors

                    
#3
Error de compilación
                      Main.java:8: error: cannot find symbol
		        Pattern pattern = null;
		        ^
  symbol:   class Pattern
  location: class Main
Main.java:9: error: cannot find symbol
		        Matcher matcher = null;
		        ^
  symbol:   class Matcher
  location: class Main
Main.java:16: error: cannot find symbol
		    		pattern = Pattern.compile(regex);
		    		          ^
  symbol:   variable Pattern
  location: class Main
3 errors

                    
#4
Error de compilación
                      Main.java:8: error: cannot find symbol
		        Pattern pattern = null;
		        ^
  symbol:   class Pattern
  location: class Main
Main.java:9: error: cannot find symbol
		        Matcher matcher = null;
		        ^
  symbol:   class Matcher
  location: class Main
Main.java:16: error: cannot find symbol
		    		pattern = Pattern.compile(regex);
		    		          ^
  symbol:   variable Pattern
  location: class Main
3 errors

                    
#5
Error de compilación
                      Main.java:8: error: cannot find symbol
		        Pattern pattern = null;
		        ^
  symbol:   class Pattern
  location: class Main
Main.java:9: error: cannot find symbol
		        Matcher matcher = null;
		        ^
  symbol:   class Matcher
  location: class Main
Main.java:16: error: cannot find symbol
		    		pattern = Pattern.compile(regex);
		    		          ^
  symbol:   variable Pattern
  location: class Main
3 errors

                    
#6
Error de compilación
                      Main.java:8: error: cannot find symbol
		        Pattern pattern = null;
		        ^
  symbol:   class Pattern
  location: class Main
Main.java:9: error: cannot find symbol
		        Matcher matcher = null;
		        ^
  symbol:   class Matcher
  location: class Main
Main.java:16: error: cannot find symbol
		    		pattern = Pattern.compile(regex);
		    		          ^
  symbol:   variable Pattern
  location: class Main
3 errors

                    
#7
Error de compilación
                      Main.java:8: error: cannot find symbol
		        Pattern pattern = null;
		        ^
  symbol:   class Pattern
  location: class Main
Main.java:9: error: cannot find symbol
		        Matcher matcher = null;
		        ^
  symbol:   class Matcher
  location: class Main
Main.java:16: error: cannot find symbol
		    		pattern = Pattern.compile(regex);
		    		          ^
  symbol:   variable Pattern
  location: class Main
3 errors

                    
#8
Error de compilación
                      Main.java:8: error: cannot find symbol
		        Pattern pattern = null;
		        ^
  symbol:   class Pattern
  location: class Main
Main.java:9: error: cannot find symbol
		        Matcher matcher = null;
		        ^
  symbol:   class Matcher
  location: class Main
Main.java:16: error: cannot find symbol
		    		pattern = Pattern.compile(regex);
		    		          ^
  symbol:   variable Pattern
  location: class Main
3 errors

                    
#9
Error de compilación
                      Main.java:8: error: cannot find symbol
		        Pattern pattern = null;
		        ^
  symbol:   class Pattern
  location: class Main
Main.java:9: error: cannot find symbol
		        Matcher matcher = null;
		        ^
  symbol:   class Matcher
  location: class Main
Main.java:16: error: cannot find symbol
		    		pattern = Pattern.compile(regex);
		    		          ^
  symbol:   variable Pattern
  location: class Main
3 errors

                    
#10
Error de compilación
                      Main.java:8: error: cannot find symbol
		        Pattern pattern = null;
		        ^
  symbol:   class Pattern
  location: class Main
Main.java:9: error: cannot find symbol
		        Matcher matcher = null;
		        ^
  symbol:   class Matcher
  location: class Main
Main.java:16: error: cannot find symbol
		    		pattern = Pattern.compile(regex);
		    		          ^
  symbol:   variable Pattern
  location: class Main
3 errors

                    
#11
Error de compilación
                      Main.java:8: error: cannot find symbol
		        Pattern pattern = null;
		        ^
  symbol:   class Pattern
  location: class Main
Main.java:9: error: cannot find symbol
		        Matcher matcher = null;
		        ^
  symbol:   class Matcher
  location: class Main
Main.java:16: error: cannot find symbol
		    		pattern = Pattern.compile(regex);
		    		          ^
  symbol:   variable Pattern
  location: class Main
3 errors

                    
#12
Error de compilación
                      Main.java:8: error: cannot find symbol
		        Pattern pattern = null;
		        ^
  symbol:   class Pattern
  location: class Main
Main.java:9: error: cannot find symbol
		        Matcher matcher = null;
		        ^
  symbol:   class Matcher
  location: class Main
Main.java:16: error: cannot find symbol
		    		pattern = Pattern.compile(regex);
		    		          ^
  symbol:   variable Pattern
  location: class Main
3 errors

                    
Puntos totales: 0 / 100

Código

import java.util.*;
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");
		    }
}