Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int countSame=0;
- // int maxRun=0;
- // String runChar="";
- // for(int i=0; i<s.length();i++){
- // String current=s.substring(i,i+1);
- // String next="";
- // if(i<s.length()-1) {
- // next= s.substring(i + 1, i + 2);
- // }
- //
- // if(current.equals(next)){
- // runChar=current;
- // System.out.printf("1: current: %s, next: %s, runchar: %s%n", current, next, runChar);
- // countSame++;
- // }
- // else if(current.equals(runChar)){
- // countSame++;
- // if(countSame>maxRun){
- // maxRun=countSame;
- // }
- // countSame=0;
- // System.out.printf("2: current: %s, next: %s, runchar: %s%n", current, next, runChar);
- // }
- // else{
- // countSame=0;
- // }
- //
- //
- //
- // }
- // System.out.println(maxRun);
Advertisement
Add Comment
Please, Sign In to add comment