Imagine you have a pile of n photos. Some of them are faced upwards and the others faced downwards. Your goal is to sort them so that all the photos are faced the same direction. The only operation you are allowed to do is to take any amount of the photos if their direction is same to the other direction. Write the program that calculates the minimum number of such operations needed to complete the sorting goal.
There are multiple test cases in the input
file.
For each test case, the first line is n (0<n<10^5) - the number
of photos.
The second line is n characters "D" - faced down or "U" - faced
up.
For each test case there is a single integer number - minimal number of flip operations required to sort the photos pile.
5
UUDUU
4
UDUD
1
2