Time Limit: 2 sec / Memory Limit: 1024 MB
Score : 400400 points
Problem Statement
An altar enshrines NN stones arranged in a row from left to right. The color of the ii-th stone from the left (1≤i≤N)(1≤i≤N) is given to you as a character cici; R
stands for red and W
stands for white.
You can do the following two kinds of operations any number of times in any order:
- Choose two stones (not necessarily adjacent) and swap them.
- Choose one stone and change its color (from red to white and vice versa).
According to a fortune-teller, a white stone placed to the immediate left of a red stone will bring a disaster. At least how many operations are needed to reach a situation without such a white stone?
Constraints
- 2≤N≤2000002≤N≤200000
- cici is
R
orW
.
Input
Input is given from Standard Input in the following for