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

Envío 6391

Problema 0x5c - Decir si hay una letra repetida

  • Autor: Camilo15
  • Fecha: 2022-07-02 22:55:10 UTC (Hace más de 2 años)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      Main.java:11: error: incompatible types: boolean cannot be converted to int
    if(letters[c-'a'>0]){
                    ^
Main.java:11: error: incompatible types: int cannot be converted to boolean
    if(letters[c-'a'>0]){
              ^
2 errors

                    
#2
Error de compilación
                      Main.java:11: error: incompatible types: boolean cannot be converted to int
    if(letters[c-'a'>0]){
                    ^
Main.java:11: error: incompatible types: int cannot be converted to boolean
    if(letters[c-'a'>0]){
              ^
2 errors

                    
#3
Error de compilación
                      Main.java:11: error: incompatible types: boolean cannot be converted to int
    if(letters[c-'a'>0]){
                    ^
Main.java:11: error: incompatible types: int cannot be converted to boolean
    if(letters[c-'a'>0]){
              ^
2 errors

                    
#4
Error de compilación
                      Main.java:11: error: incompatible types: boolean cannot be converted to int
    if(letters[c-'a'>0]){
                    ^
Main.java:11: error: incompatible types: int cannot be converted to boolean
    if(letters[c-'a'>0]){
              ^
2 errors

                    
#5
Error de compilación
                      Main.java:11: error: incompatible types: boolean cannot be converted to int
    if(letters[c-'a'>0]){
                    ^
Main.java:11: error: incompatible types: int cannot be converted to boolean
    if(letters[c-'a'>0]){
              ^
2 errors

                    
#6
Error de compilación
                      Main.java:11: error: incompatible types: boolean cannot be converted to int
    if(letters[c-'a'>0]){
                    ^
Main.java:11: error: incompatible types: int cannot be converted to boolean
    if(letters[c-'a'>0]){
              ^
2 errors

                    
#7
Error de compilación
                      Main.java:11: error: incompatible types: boolean cannot be converted to int
    if(letters[c-'a'>0]){
                    ^
Main.java:11: error: incompatible types: int cannot be converted to boolean
    if(letters[c-'a'>0]){
              ^
2 errors

                    
#8
Error de compilación
                      Main.java:11: error: incompatible types: boolean cannot be converted to int
    if(letters[c-'a'>0]){
                    ^
Main.java:11: error: incompatible types: int cannot be converted to boolean
    if(letters[c-'a'>0]){
              ^
2 errors

                    
#9
Error de compilación
                      Main.java:11: error: incompatible types: boolean cannot be converted to int
    if(letters[c-'a'>0]){
                    ^
Main.java:11: error: incompatible types: int cannot be converted to boolean
    if(letters[c-'a'>0]){
              ^
2 errors

                    
#10
Error de compilación
                      Main.java:11: error: incompatible types: boolean cannot be converted to int
    if(letters[c-'a'>0]){
                    ^
Main.java:11: error: incompatible types: int cannot be converted to boolean
    if(letters[c-'a'>0]){
              ^
2 errors

                    
#11
Error de compilación
                      Main.java:11: error: incompatible types: boolean cannot be converted to int
    if(letters[c-'a'>0]){
                    ^
Main.java:11: error: incompatible types: int cannot be converted to boolean
    if(letters[c-'a'>0]){
              ^
2 errors

                    
#12
Error de compilación
                      Main.java:11: error: incompatible types: boolean cannot be converted to int
    if(letters[c-'a'>0]){
                    ^
Main.java:11: error: incompatible types: int cannot be converted to boolean
    if(letters[c-'a'>0]){
              ^
2 errors

                    
Puntos totales: 0 / 100

Código

import java.util.*;
public class Main {

    public static void main(String[] args) throws java.lang.Exception {
        Scanner sc = new Scanner(System.in);
        String word = sc.nextLine();   
       
    int [] letters = new int[26];

    for(Character c: word.toCharArray()){
    if(letters[c-'a'>0]){
   System.out.println("yes");
   break;
       }
   letters[c-'a']++;
    }
System.out.println("no");

  }
}