300500: CF96A. Football

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Football

题意翻译

足球场上有 $n$ 人,分为 $A,B$ 两队,它们的位置可以用 $0$($A$ 队)或 $1$($B$ 队)表示。一般认为,一个队里面凡是有连续 $7$ 个队员站在一起就是危险的。现在给定他们的站位,判断是否危险。 输入仅一行,为一个长度为 $n(1\leqslant n\leqslant100)$ 的 $01$ 串,含义如题意所述。 输出仅一行,如果这种站位危险输出 $\text{YES}$,否则输出 $\text{NO}$。

题目描述

Petya loves football very much. One day, as he was watching a football match, he was writing the players' current positions on a piece of paper. To simplify the situation he depicted it as a string consisting of zeroes and ones. A zero corresponds to players of one team; a one corresponds to players of another team. If there are at least $ 7 $ players of some team standing one after another, then the situation is considered dangerous. For example, the situation $ 00100110111111101 $ is dangerous and $ 11110111011101 $ is not. You are given the current situation. Determine whether it is dangerous or not.

输入输出格式

输入格式


The first input line contains a non-empty string consisting of characters "0" and "1", which represents players. The length of the string does not exceed $ 100 $ characters. There's at least one player from each team present on the field.

输出格式


Print "YES" if the situation is dangerous. Otherwise, print "NO".

输入输出样例

输入样例 #1

001001

输出样例 #1

NO

输入样例 #2

1000000001

输出样例 #2

YES

Input

题意翻译

足球场上有 $n$ 人,分为 $A,B$ 两队,它们的位置可以用 $0$($A$ 队)或 $1$($B$ 队)表示。一般认为,一个队里面凡是有连续 $7$ 个队员站在一起就是危险的。现在给定他们的站位,判断是否危险。 输入仅一行,为一个长度为 $n(1\leqslant n\leqslant100)$ 的 $01$ 串,含义如题意所述。 输出仅一行,如果这种站位危险输出 $\text{YES}$,否则输出 $\text{NO}$。

加入题单

上一题 下一题 算法标签: