Heracles and the Hydra

No attempts yetTime limit1sMemory limit256 MB

Problem

Heracles is a tragic hero of Greek mythology. Zeus fathered him outside his marriage, so Hera, the wife of Zeus, hated him. He had great strength and deep knowledge, and he also had fits of madness in which he killed his own children, several of his teachers, and his lovers. He is best known as the man who had to carry out the twelve labours set by King Eurystheus to atone for killing his children.

The second labour was to kill the Hydra, a huge monster with many heads. Hera created the Hydra to kill Heracles.

The Hydra is hard to kill because cutting off one head makes two new heads grow in its place. The Hydra does not die while at least one head remains. Iolaus, the nephew of Heracles, found that burning the stump right after the cut stops a new head from growing.

Heracles and Iolaus perform a series of actions in order. Each action is either a plain cut, or a cut followed by burning the stump. A plain cut raises the number of remaining heads by 1, and a cut followed by burning lowers it by 1. Determine how many heads are left after the whole series of actions.

Input

The first line contains the number of data sets KK.

The first line of each data set contains the number of heads hh of the Hydra (1h501 \le h \le 50).

The second line contains the actions of Heracles and Iolaus as a string of at most 100 characters. The letter 'c' means cutting a head without burning it, and 'b' means cutting a head and then burning the stump.

Once every head of the Hydra is gone, the input gives no further action.

Output

For each data set, print Data Set x: on the first line, where xx is the number of the data set counting from 1.

On the next line, print the number of heads left on the Hydra after all the actions.

Print one blank line between consecutive data sets.