S=input().strip() ANS=0 s=0 for i in range(len(S)): if S[i]=="S": s+=1 if S[i:i+3]=="ing": ANS+=s print(ANS)