Олимпиадный тренинг

Задача 38330. Houses and shops


10 buildings were built in a row on Novy Prospekt. Each building can be either a residential building, or a shop, or an office building.

But it turned out that the residents of some houses on Novy Prospekt had to walk too far to get to the nearest store. To develop a plan for the development of public transport on Novy Prospekt, the mayor of the city asked you to find out what is the greatest distance residents of Novy Prospekt have to travel to get from their homes to the nearest store.

Input
The program receives ten numbers as input, separated by spaces. Each number specifies the type of building on Novy Prospekt: ​​number 1 indicates a residential building, number 2 indicates a store, number 0 indicates an office building. It is guaranteed that there is at least one residential building and at least one shop on Novy Prospekt.

Imprint
Print a single integer: the maximum distance from the house to the nearest store. The distance between two neighboring houses is considered equal to 1 (that is, if two houses are side by side, then the distance between them is 1, if there is another house between two houses, then the distance between them is 2, etc.)
Examples
# Input Output Explanation
1 2 0 1 1 0 1 0 2 1 2 3 In the example from the condition, residents of the fourth house have the furthest to go to the nearest store: the nearest store to their house is in the first house, and they need to walk three houses to it. Residents of other houses will have to walk a shorter distance to the nearest store, so the answer is 3.