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