#K37597. Counting Flower Changes
Counting Flower Changes
Counting Flower Changes
You are given a list of arrangements of flowers where each arrangement is represented as a string consisting of the characters 'R' and 'T'. Each character corresponds to a type of flower. Your task is to count the number of changes between consecutive flowers in each arrangement.
In other words, for every string s of length n, you need to compute the number of indices i such that s[i] \neq s[i-1] for 1 \leq i < n. Formally, if you denote the string as \(s_0s_1\cdots s_{n-1}\), then the answer for that string is given by:
[ \text{count} = \sum_{i=1}^{n-1} \mathbf{1}{{s_i \neq s{i-1}}} ]
If the input list is empty, output an empty result. The problem requires reading input from stdin and writing the output to stdout.
inputFormat
The input starts with an integer n denoting the number of test cases. Each of the following n lines contains a single string representing an arrangement of flowers consisting of characters 'R' and 'T'.
outputFormat
For each arrangement, output a single integer on a separate line indicating the number of consecutive flower type changes. If there are no arrangements, produce no output.
## sample1
RTTR
2
</p>