Football

05-11-23 6:41 AM
mail@pastecode.io avatar
unknown
plain_text
a year ago
1.8 kB
3
Indexable
import java.util.*;
 
 
public class helloWorld{
         public static void main(String[] args){
                  String inp;
                  Scanner sc = new Scanner(System.in);
                  inp = sc.next();
 
                  int length = inp.length();
                  String[] indvBits = new String[length];
 
                  for (int i = 0; i < length; i++) {
                     indvBits[i] = inp.substring(i, i + 1);
                  }
 
                  int ZeroMax = 0, OneMax = 0;
                  int zeroCurrent = 0, oneCurrent = 0;
 
                  for (int i = 0; i < length; i++) {
                     if(indvBits[i].equals("0")){
                        if(OneMax < oneCurrent){
                        OneMax = oneCurrent;
                        }
                        oneCurrent = 0;
                        zeroCurrent++;
                        continue;
                     }
                     else if(indvBits[i].equals("1")){
                        if(ZeroMax < zeroCurrent){
                        ZeroMax = zeroCurrent;
                        }
                        zeroCurrent = 0;
                        oneCurrent++;
                        continue;
                     }
                  }
 
                  if(ZeroMax < zeroCurrent){
                     ZeroMax = zeroCurrent;
                  }
                  if(OneMax < oneCurrent){
                     OneMax = oneCurrent;
                  }
 
                  if(OneMax >= 7 || ZeroMax >= 7){
                     System.out.println("YES");
                  }
                  else{
                     System.out.println("NO");
                  }
         }
}