import sys t=sys.stdin.readline() s=0 ans=0 for i in range(len(t)-2): if t[i]=='S': s+=1 elif t[i:i+3]=='ing': ans+=s print(ans)