
ZOJ Problem Set  3465
There is a hive in the village. Like this. There are 9 columns (from A to I) in this hive. Different column may have the different number of grids. Every grid has its own coordinate, which is form by a uppercase letter and a digit. The uppercase letter discribes which column the grid is, the digit discribes which row the grid is. As the figure shows, column A has 7 grids, column B has 8 grids, column C has 9 grids, column D has 10 grids, column E has 11 grids, column F has 10 grids, column G has 9 grids, column H has 8 grids, column I has 7 grids. The grid in the bottom has the lowest row coordinate which is 0.There are 26 kinds of honey. At the beginning, all grids in the hive are empty. Everyday, the bee in this hive will drop a kind of honey from the top of one of these 9 columns. The lowest empty grid of this column will be filled with this kind of honey. And if the grid under it adjacently has the same kind of honey as it did, these two grids will generate a candy. And these two grids will be empty immediately. Because these columns only have a few grids, they may be full one day. If the column the bee drops on is full, this drop will not affect the hive. InputThere are multiple cases (<20). The first line containing an integer n (1 <= n <= 10000) indicates that the bee will work for n days. Following n lines, each line contains two charater. The fisrt one indicates which column will the bee drop the honey, the second charater indicates which kind of honey does the bee drop that day. Output
First,print one line in the form "The number of candy is num_of_candy.". Sample Input5 AE BH CI DF AE Sample OutputThe number of candy is 1. _ _/ \_ _/ \_/ \_ _/ \_/ \_/ \_ _/ \_/ \_/ \_/ \_ / \_/ \_/ \_/ \_/ \ \_/ \_/ \_/ \_/ \_/ / \_/ \_/ \_/ \_/ \ \_/ \_/ \_/ \_/ \_/ / \_/ \_/ \_/ \_/ \ \_/ \_/ \_/ \_/ \_/ / \_/ \_/ \_/ \_/ \ \_/ \_/ \_/ \_/ \_/ / \_/ \_/ \_/ \_/ \ \_/ \_/ \_/ \_/ \_/ / \_/ \_/ \_/ \_/ \ \_/ \_/ \_/ \_/ \_/ / \_/ \_/ \_/ \_/ \ \_/H\_/ \_/ \_/ \_/ \_/I\_/ \_/ \_/ \_/F\_/ \_/ \_/ \_/ \_/ Author: LIANG,Jiaxing Contest: ZOJ Monthly, January 2011 