#include using namespace std; int main(){ string S; cin >> S; int N = S.size(); int cnt = 0; long long ans = 0; for (int i = 0; i <= N - 3; i++){ if (S[i] == 'S'){ cnt++; } if (S.substr(i, 3) == "ing"){ ans += cnt; } } cout << ans << endl; }