# Dogs and Cats Solution Kickstart

You work for an animal shelter and you are responsible for feeding the animals. You already prepared  portions of dog food and  portions of cat food.

There are a total of  animals waiting in a line, some of which are dogs and others are cats. It might be possible that all the animals in the line are dogs or all the animals are cats. A string  of  characters C and D represents the order of cats and dogs in the line. The -th character is equal to C if the -th animal in the line is a cat. Similarly, the -th character is equal to D if the -th animal in the line is a dog.

The animals are fed in the order they stay in the line. Each dog eats exactly  portion of dog food and similarly each cat eats exactly  portion of cat food. Moreover, you have extra portions of cat food. Every time a dog eats food, you bring  extra portions of cat food for cats.

Animals have to be fed in the order they wait in line and an animal can only eat if the animal before it has already eaten. That means that if you run out of dog (or cat) food portions and a dog (or a cat) is about to get fed, the line will not move, as all the animals will wait patiently.

You need to determine if in this scenario all the dogs in the line will be fed. Note that this means that some cats might remain in the line, but worry not, you will eventually feed them later!

### Input Dogs and Cats Solution Kickstart

The first line of the input gives the number of test cases,  test cases follow.

The first line of each test case contains four integers , and : the number of animals, the initial number of dog food portions, the initial number of cat food portions, and the additional portions of cat food that we add after a dog eats a portion of dog food, respectively.

The next line contains a string  of length  representing the arrangement of animals.

## Output Dogs and Cats Solution Kickstart

For each test case, output one line containing Case #: , where  is the test case number (starting from ) and  is YES if all the dogs will be fed and NO otherwise.

## Limits Dogs and Cats Solution Kickstart

Memory limit: 1 GB.
.
.
.
consists of only characters C and D.

#### Test Set 1

Time limit: 20 seconds.

#### Test Set 2

Time limit: 40 seconds.
.

## Sample Dogs and Cats Solution Kickstart

Note: there are additional samples that are not run on submissions down below.

Sample Input
3
6 10 4 0
CCDCDD
4 1 2 0
CCCC
4 2 1 0
DCCD

Sample Output
Case #1: YES
Case #2: YES
Case #3: NO


In Sample Case #1, there are  portions of dog food and  portions of cat food.

1. The first two animals are cats, so after they eat,  portions of cat food remain.
2. Then a dog eats one portion of dog food. Now, there are  portions of dog food left.
3. Next, a cat eats a portion of cat food, reducing the number of portions of cat food to .
4. The last two animals are dogs and they each eat one portion of dog food.

So in this case, all the dogs are able to eat.

In Sample Case #2, there are no dogs. Hence, all (zero) dogs will be able to eat trivially.

In Sample Case #3, the cat before the second dog will not be able to eat because there will not be enough portions of cat food. Hence, the second dog will also not eat.

### Additional Sample – Test Set 2 Dogs and Cats Solution Kickstart

The following additional sample fits the limits of Test Set 2. It will not be run against your submitted solutions.

Sample Input
2
12 4 2 2
CDCCCDCCDCDC
8 2 1 3
DCCCCCDC

Sample Output
Case #1: YES
Case #2: NO


In Sample Case #1,  portions of cat food appear whenever a dog eats a portion of dog food.

1. After the first cat eats, there is  portion of cat food left.
2. Then a dog eats, leaving  portions of dog food and  portions of cat food.
3. After the next  cats eat, there are  portions of dog food and  portions of cat food remaining.
4. Then a dog eats, leaving  portions of dog food and  portions of cat food.
5. After the next  cats eat food, there are  portions of dog food and  portions of cat food left.
6. Now a dog eats, leaving  portion of dog food and  portions of cat food.
7. Next a cat eats, leaving  portion of dog food and  portion of cat food.
8. The last dog eats the remaining portion of dog food.

So in this case, all the dogs are able to eat.

In Sample Case #2, the cat before the second dog will not be able to eat because there will not be enough portions of cat food.

### Problem Dogs and Cats Solution Kickstart

Charles defines the goodness score of a string as the number of indices  such that  where  (-indexed). For example, the string CABABC has a goodness score of  since  and .

Charles gave Ada a string  of length , consisting of uppercase letters and asked her to convert it into a string with a goodness score of . In one operation, Ada can change any character in the string to any uppercase letter. Could you help Ada find the minimum number of operations required to transform the given string into a string with goodness score equal to ?

### Input Dogs and Cats Solution Kickstart

The first line of the input gives the number of test cases,  test cases follow.

The first line of each test case contains two integers  and . The second line of each test case contains a string  of length , consisting of uppercase letters.

### Output

For each test case, output one line containing Case #: , where  is the test case number (starting from 1) and  is the minimum number of operations required to transform the given string  into a string with goodness score equal to .

### Limits Dogs and Cats Solution Kickstart

Memory limit: 1 GB.
.
.

#### Test Set 1

Time limit: 20 seconds.
.

#### Test Set 2

Time limit: 40 seconds.
for at most  test cases.
For the remaining cases, .

### Sample

Sample Input
2
5 1
ABCAA
4 2
ABAA

Sample Output
Case #1: 0
Case #2: 1


In Sample Case #1, the given string already has a goodness score of . Therefore the minimum number of operations required is .

In Sample Case #2, one option is to change the character at index  to B in order to have a goodness score of . Therefore, the minimum number of operations required is .