#C405. Minimum Changes to Avoid Consecutive Red Lights

    ID: 47545 Type: Default 1000ms 256MiB

Minimum Changes to Avoid Consecutive Red Lights

Minimum Changes to Avoid Consecutive Red Lights

You are given a string s representing a sequence of traffic lights. Each character of s is either R (red) or G (green). A configuration is considered valid if there are no two consecutive red lights. In one change, you can change a red light to a green light. Your task is to compute the minimum number of changes needed to make the sequence valid.

In mathematical terms, for a given string s, for every index i such that:

(si=R and si+1=R)(s_i = R \text{ and } s_{i+1} = R)

you should increment the counter and skip the next light, as it has been effectively fixed. This method ensures that there are no two adjacent red lights left in the sequence.

inputFormat

The input consists of a single line containing a non-empty string s composed only of the characters 'R' and 'G'. The input is read from standard input (stdin).

outputFormat

Output a single integer representing the minimum number of changes required so that there are no two consecutive 'R' characters in the string. The output should be written to standard output (stdout).

## sample
GRGRG
0