#yuki1159 t=input() s=0 res=0 for i in range(len(t)-2): if t[i]=='S': s+=1 elif t[i:i+3]=='ing': res+=s print(res)