s=m=0 for c in input().replace('ing','.'): if c=='S':s+=1 if c=='.':m+=s print(m)