Your companion Gopal is a fighter and he gets orders from his sergeant. He gets N orders. Orders are of 2 sorts: ‘L′(Left) sets the position x:=x−1 ′R′ (Right) sets the position x:=x+1. Envision Gopal is remaining at x=0 on the number line at first. Gopal is remarkably drained from his past drills so he here and there guilefully avoids a few orders. On the off chance that the order is overlooked by Gopal, Then the position x doesn’t change and Gopal essentially continues to the following order. 

For instance, in the event that Gopal is old “LRLR”, at that point here are some potential results (italics orders are executed effectively): 

“LRLR” — He moves to one side, to one side, to one side again and to one side for the last time, winding up at position 0. 

“LRLR” — He doesn’t move at all and winds up at position 0 too. 

“LRLR” — He moves to one side, at that point to one side again and winds up in position −2. 

You don’t have the foggiest idea about the orders which will be effectively executed by him already. In this manner, he needs to know what number of various positions may he wound up at. 



The principal line contains n — the quantity of orders sergeant sends. 

The subsequent line contains a string s of n orders, each either ′L′ (Left) or ′R′ (Right). 


Print one whole number — the quantity of various positions Gopal may wind up at. 





Test Input: 



Test Output: 



He may wind up anyplace somewhere in the range of −2 and 2.


March Long Challenge 2021 Solutions

April Long Challenge 2021 Solutions

Codechef Long Challenge Solutions

February Long Challenge 2021

1. Frog Sort Solution Codechef

2. Chef and Meetings Solution Codechef

3. Maximise Function Solution Codechef

4. Highest Divisor Solution Codechef

5. Cut the Cake Challenge Solution Codechef

6. Dream and the Multiverse Solution Codechef

7. Cell Shell Solution Codechef

8. Multiple Games Solution Codechef

9. Another Tree with Number Theory Solution Codechef

10. XOR Sums Solution Codechef

11. Prime Game Solution CodeChef

12. Team Name Solution Codechef

January Long Challenge 2021

November Challenge 2020 SOLUTION CodeChef

October Lunchtime 2020 CodeChef SOLUTIONS


Related :

Related :

Leave a Comment

5 × one =