Car Park

No attempts yetTime limit1sMemory limit128 MB

Problem

Please build a management system for a car park. The car park has a fixed number of parking spaces. It wants to tell approaching drivers how many spaces are currently available, and it must keep the entry barrier from opening once the park is full.

For each car park (scenario) you are given the number of cars already parked and a string of signals from the entry and exit barriers. Process the signals in order, and report how many cars remain in the car park at the end of each scenario.

Input

The input consists of several scenarios, each representing a different car park.

The first line of each scenario contains two integers $S$ and $C$ ($10 \le S \le 500$, $0 \le C \le S$). $S$ is the total number of spaces in the car park, and $C$ is the number of cars currently parked there.

The second line of each scenario is a string of up to $255$ characters, each of which is the upper-case letter I or O. This string represents a stream of data from the entry and exit barriers.

  • I means that a car has attempted to enter the car park. If the car park is not full, the car is allowed in and counted. If every space is occupied, the car is refused entry and is not counted (it may try again later).
  • O means that a car has driven out of the car park.

If there are no cars in the car park when an O appears in the stream, that O is an error, and processing of that scenario stops immediately.

The last scenario is 0 0; this scenario is not processed.

Output

Print one line for each scenario. If there was an error in the data stream, the line contains just the word error. Otherwise, print a single integer: the number of cars in the car park at the end of the scenario.