#B4193. Maximal Alternating Seating Arrangement

    ID: 11850 Type: Default 1000ms 256MiB

Maximal Alternating Seating Arrangement

Maximal Alternating Seating Arrangement

The team consists of \(a\) boys and \(b\) girls who need to travel by train to a competition. The first coach of the train has \(n\) consecutive seats, each of which is either empty or already occupied by a passenger. In order to foster communication between the boys and girls, the seating must be arranged so that any two adjacent team members (i.e. students) are not of the same gender.

From the total \(a+b\) students available, your task is to choose as many as possible to fill the empty seats in the first coach, while ensuring that no two adjacent occupied seats (by team members) have students of the same gender.

The already occupied seats (denoted by '*') cannot be used, and they reset the seating pattern, i.e. the adjacent gender constraint applies only among the placed students in consecutive empty seats.

inputFormat

The first line contains three integers \(n\), \(a\), and \(b\) separated by spaces, where \(n\) is the number of seats in the first coach, \(a\) is the number of boys and \(b\) is the number of girls available.

The second line is a string of length \(n\) consisting of the characters '.' and '*'. A dot '.' represents an empty seat and an asterisk '*' represents a seat that is already occupied.

outputFormat

Output a single integer representing the maximum number of students that can be seated in the empty seats while satisfying the alternating gender constraint (i.e. no two adjacent team members are of the same gender).

sample

5 1 1
...*.
2