import re s=re.sub(r'S','0',input()) s=re.sub(r'ing','1',s) s=re.sub(r'[a-zA-Z]','',s) l=list(map(int,list(s))) a=c=0 for i in l: if i<1: a+=1 else: c+=a print(c)