Problem:
Problem A. GuruGuru

You are playing a game called Guru Guru Gururin. In this game, you can move with the vehicle called Gururin. There are two commands you can give to Gururin: 'R' and 'L'. When 'R' is sent, Gururin rotates clockwise by 90 degrees. Otherwise, when 'L' is sent, Gururin rotates counterclockwise by 90 degrees.

During the game, you noticed that Gururin obtains magical power by performing special commands. In short, Gururin obtains magical power every time when it performs one round in the clockwise direction from north to north. In more detail, the conditions under which magical power can be obtained is as follows.

At the beginning of the special commands, Gururin faces north.

At the end of special commands, Gururin faces north.

Except for the beginning and the end of special commands, Gururin does not face north.

During the special commands, Gururin faces north, east, south, and west one or more times, respectively, after the command of 'R'.

At the beginning of the game, Gururin faces north. For example, if the sequence of commands Gururin received in order is 'RRRR' or 'RRLRRLRR', Gururin can obtain magical power. Otherwise, if the sequence of commands is 'LLLL' or 'RLLR', Gururin cannot obtain magical power.

Your task is to calculate how many times Gururin obtained magical power throughout the game. In other words, given the sequence of the commands Gururin received, calculate how many special commands exists in it.

Input

The input consists of a single test case in the format below.

$S$

The first line consists of a string $S$, which represents the sequence of commands Gururin received. $S$ consists of 'L' and 'R'. The length of $S$ is between $1$ and $10^3$ inclusive.

Output

Print the number of times Gururin obtained magical power throughout the game in one line.

Examples

Sample Input 1

RRRRLLLLRRRR

Output for Sample Input 1

2

Sample Input 2

RLLRLLLLRRRLLLRRR

Output for Sample Input 2

0

Sample Input 3

LR

Output for Sample Input 3

0

Sample Input 4

RRLRRLRRRRLRRLRRRRLRRLRRRRLRRLRR

Output for Sample Input 4

4

Solution in C# (judge verdict: Accepted)

using System;
using System.Collections.Generic;

namespace TESt
{
    class Program
    {
    internal class GuruGuru
    {
        int tempPower = 0;
        public int Power { get; private set; } = 0;

        internal void Execute()
        {
            //Console.WriteLine("Please enter the string of operations performed by Guru Guru: ");
            string input = Console.ReadLine();

            for (int i = 0; i < input.Length; i++)
            {
                if (input[i] == 'R')
                    ++tempPower;
                else if (input[i] == 'L')
                    --tempPower;

                // tempPower = 4 means one full clockwise rotation so we increment mystical power.
                if (Math.Abs(tempPower) == 4)
                {
                    if(tempPower == 4)
                        ++Power;
                        
                    tempPower = 0;
                }
            }

            //Console.WriteLine("Number of times mystical powers activated were: {0}", Power);
             Console.WriteLine(Power);
        }
    }
        
        static void Main(string[] args)
        {
            new GuruGuru().Execute();
        }
    }
}