RT.
#include "bits/stdc++.h"
using namespace std ;
#define For(i,l,r) for(int i=(l);i<=(r);++i)
string s,x,r(" friend") ;
int ans=1,flag=1 ;
vector<pair<int,int> > vec ;
int main() {
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0) ;
s=" ";cin>>x;s+=x ;
if(s.size()<=6) {cout<<0;return 0;}
For(i,1,s.size()-1) {
if(s[i]==r[flag]) flag++ ;
else flag=1 ;
if(flag==7) vec.push_back(make_pair(i-6,0)) ;
}
if(!vec.size()) {cout<<0;return 0;}
For(i,1,vec.size()-1) {
ans++ ;
if(vec[i].first-vec[i-1].first<=8&&!vec[i-1].second) {
ans--;vec[i-1].second=vec[i].second=1 ;
}
}
cout<<ans ;
return 0 ;
}