One of the touchier disputes in an office is whether the toilet seat should be left up or down. The minutes employees spend putting the seat where they want it add up to hours every week, so at a large company the question reaches working time. Count how many seat adjustments a bathroom policy causes.
The usual assumption is that a man uses the toilet with the seat up and a woman uses it with the seat down. Here we split people only into those who prefer the seat up and those who prefer it down, regardless of gender.
Several policies are possible. Consider these three.
So a person may have to adjust the seat before using the toilet and, depending on the policy, may have to adjust it again before leaving. One adjustment is one move of the seat, up or down.
Given the preferences of the people in order, compute how many adjustments happen in total under each of the three policies.
The first and only line contains a string made of the characters 'U' and 'D'. Its length is at least 2 and at most 1000.
Let n be the length of the string. The first character is the initial position of the toilet seat, where 'U' means up and 'D' means down. The remaining n−1 characters give the preferred position of the n−1 people who use the toilet, in order.
Print one number on each of three lines: the total number of seat adjustments under policy 1, then under policy 2, then under policy 3.