using System;
public class Program
{
public static void Main()
int count = 0;
string str = Console.ReadLine();
for(int i = 0 ; i < str.Length ; i++)
if(str[i] == 'H')
for(int j = i+1 ; j < str.Length ; j++)
if(str[j] == 'S')
for(int k = j + 1 ; k < str.Length ; k++)
if(str[k] == 'L')
count++;
}
Console.WriteLine(count);