SP26306 INC2015F - Pointers

Description

You are given an R rows x C columns grid map where each cell contains an arrow (one of the following: '^', '>', '' means you should go to cell (r, c+1). - '

Input Format

The first line of input contains an integer T (T

Output Format

For each case, output in a line "Case #X: Y" where X is the case number, starts from 1. and Y is the minimum number of arrows you need to change to accomplish the given goal. Output -1 for Y, if it's not possible to do so.