Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 players of some team standing one after another, then the situation is considered dangerous. For example, the situation is dangerous and is not. You are given the current situation. Determine whether it is dangerous or not.
Input
The first input line contains a nonempty string consisting of characters and which represents players. The length of the string does not exceed characters. There's at least one player from each team present on the field.
Output
Print "YES" if the situation is dangerous. Otherwise, print NO
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started