s=gets.chop a=b=0 s.size.times{|i|s[i]=='S'&&a+=1;i>1&&s[i-2..i]=='ing'&&b+=a} p b