PONDO2 - Pondo Two
The Pondo are a peaceful race of black and white bears which live by eating bomboo (a rare plant), much like the Pundu, except the Pundu eat bumbuu.
Today the Council of Pondo are deciding to be merciful and give back some of the land which they stole from the Pundu thousands of years ago.
Currently the land of the Pondo is a one dimensional section of land where each metre of land either contains a bumbuu (represented by a u
) or a bomboo (represented by an o
). To the right of the land of the Pondo, is the land of the Pundu, so the Pondo will give some section of the right side of their land tot the Pundu. The Pundu leader will ask for some land from the Pondo, however since the Pondo are greedy, they won't give more bumbuu to the Pundu than the amount of bomboo they lose after giving the land.
Determine the maximum amount of land that the Pundu can get back.
Input
The first line will contain an integer n
(n <= 100,000
) representing the number of metres long the Pondo land mass is.
The second line will contain a single string of length n
, with each character being either u
(meaning the land contains bumbuu) or o
(meaning the land contains bomboo), the i
-th character representing the state of the land mass i
metres right from the left end of the Pondo land mass.
Output
A single integer representing the maximum amount of land (in metres) that the Pundu leader can ask for.
Sample Cases
Input 1 6 uuouou Output 1 4
Input 2 6 uuuouo Output 2 4
Input 3 6 uuuooo Output 3 6
Added by: | jslew |
Date: | 2021-12-28 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |