In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].

If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.

<Submit a solution> [0/100]**Task statistics**

Number of users: 564

Number of users with 100 points: 210

Average result: 60.1064

# Salad Bar

### Memory limit: 128 MB

## Input

## Output

## Example

Number of users: 564

Number of users with 100 points: 210

Average result: 60.1064

Bytea went to a salad bar. There are fruits one next to another on the bar counter. Specifically, these are apples and oranges. Bytea can pick any contiguous part of the line of fruits for her salad.

The fruits she chooses will be added to the salad either from left to right or from right to left. As Bytea loves oranges, she requires that throughout the salad making process, the number of oranges in it should always be no smaller than the number of apples, regardless of whether these are added % from left to right or from right to left. Help Bytea out by writing a program that will find the longest contiguous part of the line of fruits that satisfies her requirements.

The first line of the standard input contains a single integer
(), denoting the number of fruits.
The next line contains a string of characters ().
These stand for Polish names of apples and oranges: *jab\l{*ka} and *pomara\'ncze*).
Consequently, if , then the -th fruit in a line is an apple,
and otherwise it is an orange.

You may assume that in tests worth of the total score , and moreover that in test worth of the total .

The first and only line of the standard output should contain a single integer equal to the number of fruits in the longest contiguous part of the line that satisfies Bytea's requirements. Note that it could be the case that is the correct result.

For the input data:

6 jpjppj

the correct result is:

4

**Explanation:** Once the leftmost and the rightmost apples are discarded, Bytea can order a salad out of all remaining fruits.

*Task author: Jacek Tomasiewicz.*