GUVI
Back

Rain

Created 2 years ago
21 Views
1 Comments
Subham7TC2Ke
@Subham7TC2Ke
Subham7TC2Ke
@Subham7TC2KeProfile is locked. Login

Jack doesn't like water. That's why he doesn't like rain. So to avoid rain he starts to see the weather prediction. The weather prediction in his area is very accurate. After seeing the weather prediction, he decided to take an umbrella when it is raining. He daily goes to school from home and from school to home. To avoid rain he's going to buy several umbrellas and store them at home and at school and he is going to use them when it's raining. When he goes to school and it's raining he takes one umbrella from the home and uses it on the way and leaves it at school. Similarly, when he goes back home and it is raining he takes on an umbrella from school and uses it on way and leaves it at home. You are given the forecast of \(N\) days, find out how much umbrella Jack must buy and store at home and school, in a way that he never gets wets and doesn't carry an umbrella when it is not raining. He wants to buy as minimum umbrellas as possible.

INPUT: The first line of input contains an integer \(N\), indicating the number of days. The following lines contain two characters \(H, S\) denoting the weather prediction at a time when he goes to school and comes back home respectively. Here 'R' denote rain and 'W' denote weather.

OUTPUT: Print two integers denoting the minimum umbrellas he needs to store at Home and at School.

Sample input

Sample output

3

N R

N R

N R

0 3

Explanation of Sample I/O

Here he doesn't need to store at Home and store 3 umbrellas at School.

OTHER SAMPLE

INPUT:
2
N R
R N

OUTPUT:
0 1

Comments
Please login to comment.
 
Powered by habitate.io Habitate