ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1723. Sandro's Book

WA 4
Posted by Jonnathan 25 Oct 2012 10:23
My Source

import java.util.*;
public class JavaApplication3 {

public static void main(String[] args) {
String SubPalabra1="";
String SubPalabra2="";
String Correcta="";

int menor;
String resto="";
Scanner D=new Scanner(System.in);
String palabra=D.nextLine().trim();
if(palabra.length()!=1){
for(int i=0;i<palabra.length();i++){
resto=palabra.substring(i+1, palabra.length());
if(resto.indexOf(palabra.charAt(i))!=-1){
SubPalabra1=""+palabra.charAt(i)+resto.substring(0,resto.length());
SubPalabra2=""+resto.substring(resto.indexOf(palabra.charAt(i)),resto.length());
if(SubPalabra1.length()<SubPalabra2.length()){
menor=SubPalabra1.length();
}
else{
menor=SubPalabra2.length();
}
for(int j=0;j<menor;j++){

if(SubPalabra1.charAt(j)==SubPalabra2.charAt(j)){
}
}
else{
j=menor;
}
}
}

}
}
else{
System.out.println(palabra);
}
System.out.println(Correcta);

}
}

Who is the word that no work?