#include
#include
#include
#pragma GCC optimize("Ofast")
#define ll long long
#define ld long double
using namespace std;
signed main() {
string s;
getline(cin,s);
ll cnt = 0;
for(ll i = s.length()-1; i >= 0; i--){
if(s[i] == 'f')
cnt++;
if(s[i] == 'f' && cnt == 2)
cout << i;</strong>
}
if(cnt < 2)
cout << "Мало букв f";</strong>
}