fork download
  1. import java.util.Scanner;
  2.  
  3. public class Main{
  4. public static void main(String[] args){
  5. Scanner sc = new Scanner(System.in);
  6. String rs = sc.next();
  7. int c=1, max=0;
  8. for(int i=0;i<rs.length();i++){
  9. if(i<rs.length()-1 && rs.charAt(i) == rs.charAt(i+1)){
  10. c++;
  11. }else{
  12. if(c>max)
  13. max = c;
  14. c=1;
  15. }
  16. }
  17. System.out.println(max+" c:"+c);
  18. System.out.println((max>=7)?"YES":"NO");
  19. }
  20. }
Success #stdin #stdout 0.16s 60912KB
stdin
00100110111111101
stdout
7 c:1
YES