printРабочее место участника


1912. Scarecrow

Ограничения: время – 200ms/500ms, память – 256MiB Ввод: input.txt или стандартный ввод Вывод: output.txt или стандартный вывод copy
Послать решение Blockly Посылки Темы Где Обсудить (0)

Taso owns a very long field. He plans to grow different types of crops in the upcoming growing season. The area, however, is full of crows and Taso fears that they might feed on most of the crops. For this reason, he has decided to place some scarecrows at different locations of the field.
The field can be modeled as a 1 x N grid. Some parts of the field are infertile and that means you cannot grow any crops on them. A scarecrow, when placed on a spot, covers the cell to its immediate left and right along with the cell it is on.
Given the description of the field, what is the minimum number of scarecrows that needs to be placed so that all the useful section of the field is covered? Useful section refers to cells where crops can be grown.
Input Format
Input starts with a line containing an integer `N` (`1\ ≤\ N\ ≤\ 100`). The next line contains `N` characters that describe the field. A dot ('.') indicates a crop-growing spot and a hash ('#') indicates an infertile region.
Output Format
Output the number of scarecrows that need to be placed.

Sample Input #1


Sample Output #1


Sample Input #2


Sample Output #2


Sample Input #3


Sample Output #3