i have a String and i want to test if there is at least one (different) character that is repeated three times (or more) consequently
e.g.
aaabcde->true
a
bbbcde->true
a
bbbc
dddde->true
i have to use 1) the charAt(), 2) substring(), 3) length()
...String s=readLine("type a string.");
if (s.length()>=3){
int i=0;
for (i=0; i<s.length()-2;i++){
/**i am stuck here (how to say substring(i, i+2) equals to three times the charAt(i) */ println("true");
break;
}
}
}else{ println("false");
}...