Category
Similar Problems
0771. Crosses and Crosses
Time limit : 1000 ms
Memory limit : 64 mb
The game of Crosses and Crosses is played on the field of 1 × n cells. Two players make moves in turn. Each move the player selects any free cell on the field and puts a cross ‘×’ to it. If after the player’s move there are three crosses in a row, he wins and the game stops.
You are given a position in the game. Find out, who has won the game.
Input
The input file contains one line containing only characters ‘x’ (ASCII code 120) denoting crosses and ‘.’ (ASCII code 46) denoting empty cells. The number of cells in the given position does not exceed 30.
Output
The first line of output file should contain one of the following strings:
“First”, if the first player has won the game;
“Second”, if the second player has won the game;
“Nobody”, if nobody has won yet;
“Invalid”, if the position is invalid, i.e. it could not have been reached in a correctly played game.
Samples
№ |
Input |
Output |
1 |
x.xxx.x |
First |
2 |
xxxxxxxx |
Invalid |
Text from: Uzbekistan subregional