#include<iostream> #include<string.h> using namespace std; int main() { int n; cin>>n; int t=1; string s; string f="fork"; int sum=0; while(n--) { cin>>s; if(s==f) t=t*2%100000007; else sum=(sum+t)%100000007; } cout<<sum; }
#include<iostream> #include<string.h> using namespace std; int main() { int n; cin>>n; int t=1; string s; string f="fork"; int sum=0; while(n--) { cin>>s; if(s==f) t=t*2%100000007; else sum=(sum+t)%100000007; } cout<<sum; }