#include<bits/stdc++.h>
using namespace std;
bool check(char c1, char c2){
if(c1==c2){
return true;
}
if(c1=='a' && c2=='o'){
return true;
}
if(c1=='o' && c2=='a'){
return true;
}
if(c1=='t' && c2=='l'){
return true;
}
if(c1=='l' && c2=='t'){
return true;
}
return false;
}
bool helper(string &str, string &test, int n, int m, int K, bool mark, bool deleteOnce){
if(m==0){
return true;
}
if(n==0){
return false;
}
bool res=false;
if(check(str[n-1],test[m-1])==true){
res=res | helper(str,test,n-1,m-1,K,true,deleteOnce);
}
else if(K>0 && mark==true){ //mark represents that substring has started now, and now we can use K to ignore
res=res | helper(str,test,n-1,m,K-1,true,deleteOnce);
}
if(deleteOnce==false){ // delete once says, we can delete any character in ticket atleast once
res=res | helper(str,test,n,m-1,K,mark,true);
}
if(mark==false){ // if mark is false, this means substring has not started yet, just move ahead in baseString
res=res | helper(str,test,n-1,m,K,false,deleteOnce);
}
return res;
}
int main() {
string s="aabacd";
vector<string> str={"abcde","aoc","aabade"};
int res=0;
int K=2;
for(auto e: str){
if(helper(s,e,s.size(),e.size(),K,false,false)==true){
res++;
}
}
cout<<res;
return 0;
}