One bunch of branches
Time limit0.25sMemory limit1024 MB
Given the colors of a 10x10 grid of branches, decide whether any full row or column is one single color.
- Level
Easy2 of 10
- Topics
- Array, Implementation
- Solved
- No attempts yet
Problem
Each cell of a grid holds one branch. The kiwi bird can connect all branches in 10 consecutive cells in a row, or all branches in 10 consecutive cells in a column, each one exactly once, in a single line. A bunch of branches is exactly 10 branches of the same color connected together. Given the color of the branch in each cell, determine whether the kiwi bird can make one bunch of branches.

A bunch made from all branches in the first row.
Input
The first line through the tenth line each contain the colors of the 10 branches in that row, separated by spaces. The c-th string on the r-th line is the color of the branch in row r, column c. A color is a string of 1 to 8 lowercase English letters.
Output
Print 1 if the kiwi bird can make a bunch of branches. Otherwise, print 0.