eolymp
bolt
Try our new interface for solving problems
Problems

Reverse Game

Reverse Game

Alice and Bob are playing a turn-based game. The rules of the game are as follows: \begin{enumerate} \item At the beginning of the game some binary string $s$ is chosen. \item On his turn player has to choose some substring $t$ of $s$, equal to one of $10, 110, 100, 1010$. Then the player has to reverse $t$. For example, if $s = 010101$, the player can select substring $t = 1010$ and reverse it, obtaining $s = 001011$. \item The player who can’t make a move (who can't choose an appropriate substring $t$) loses. \item The players cannot skip a turn. \end{enumerate} Which player has the winning strategy, if Alice moves first? A string $a$ is a substring of a string $b$ if $a$ can be obtained from $b$ by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end. \InputFile The only line contains a binary string $s~(1 \le |s| \le 10^6)$ --- the string with which Alice and Bob play. \OutputFile If Alice wins, output \textbf{Alice}. Otherwise, output \textbf{Bob}. \Examples In the first sample, Alice can choose substring $10$ of $010$ and reverse it, obtaining string $001$. Bob can't make any move with this string, and loses. In the second sample, Alice can’t make a single move and loses.
Time limit 1 second
Memory limit 128 MiB
Input example #1
010
Output example #1
Alice
Input example #2
1111
Output example #2
Bob
Input example #3
1010
Output example #3
Bob
Input example #4
1010001011001
Output example #4
Alice
Source 2020 SEERC South Eastern European Regional Programming Contest, Vinnica & Bucharest, May 23, Problem B