Crazy Forks
면접 대비시간 제한1초메모리 제한2048 MB
잘린 ASCII 이미지로 포크를 읽어 손잡이의 행 개수와 각 갈래의 길이를 왼쪽부터 순서대로 출력한다.
문제
John runs a shop selling antique silverware. He recently got some great publicity, and now lots of people are bringing in old collections of spoons, knives, and forks. He wants to sort the forks by size, shape, and type, but there are simply too many of them. John decides to use a camera and a computer program to label the forks automatically, but he isn't much of a programmer. John needs your crazy image-processing skills.
You helped Jon set up a camera which is reliably snapping a black-and-white image of each fork. But John needs numerical measurements. Write some code to read in each image, and output the lengths of the handle and each of the tines.
입력
Every input is an image of some fork, drawn out with spaces (" ") as white pixels and hashes ("#") as black pixels.
Each line of the input is a mix of () white pixels and () black pixels. These lines are the rows of our image.
Note: The lines may each be less than characters long, since extra spaces at the end of the line have all been removed. There may also be fewer than lines of input, since empty rows have all been removed.
Every input starts with () rows showing the handle of the fork. This handle section has or more white columns and then a black column.
After the end of the handle section, there is a single row of () black pixels, with no white pixels between them.
The remaining () rows show the tines of the fork. There are () tines, each a column of back pixels separated by columns of white pixels. The left-most column will always be a tine. Likewise, the rightmost tine aligns with the right side of the horizontal line above.
출력
The output consists of two lines. The first line prints the length in rows, , of the handle.
The second line is a space delineated list of numbers, each in the range . Each number is the length of a tine in rows, with the numbers ordered left-to-right according to the tines' positions in the input.