s = input() s_count = 0 ans = 0 for i in range(len(s) - 2): if s[i] == "S": s_count += 1 elif s[i:i + 3] == "ing": ans += s_count print(ans)