public class TestString11 {
public static void main(String args[]){
String s = "abBBBBBBcdeeefgh";
String result = "";
int count = 0;
int max = count;
int i,j;
for(i = 0; i < s.length(); i++){
for(j = i + 1; j < s.length(); j++){
if(s.charAt(i) == s.charAt(j)){
count++;
}
else
break;
}
if(count > max){
max = count;
result = s.substring(i,j);
}
count = 0;
}
System.out.println(result);
}
}
public static void main(String args[]){
String s = "abBBBBBBcdeeefgh";
String result = "";
int count = 0;
int max = count;
int i,j;
for(i = 0; i < s.length(); i++){
for(j = i + 1; j < s.length(); j++){
if(s.charAt(i) == s.charAt(j)){
count++;
}
else
break;
}
if(count > max){
max = count;
result = s.substring(i,j);
}
count = 0;
}
System.out.println(result);
}
}