/** * @FileName a.cpp * @Author kanpurin * @Created 2020.08.13 17:54:19 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { string s;cin >> s; vector<int> v; for (int i = 0; i < s.size(); i++) { if (s[i] == 'S') v.push_back(0); else if (i + 2 < s.size() && s[i] == 'i' && s[i+1] == 'n' && s[i+2] == 'g') { v.push_back(1); i+=2; } } int ans = 0; int cnt = 0; for (int i = 0; i < v.size(); i++) { if (v[i]==0)cnt++; else ans+=cnt; } cout << ans << endl; return 0; }