Portal: I love you
Given a text string, the number of required sequence comprising (may not be consecutive) "iloveyou": the meaning of the questions
in the text string case where dp [i] [j] represents the substring 0-i-1, 0-j in the text there are number of sub sequences.
T s first consider to consider
a state transition equation:
if s [i-1] = [ j-1] when t, dp [i] [j ] = dp [i-1] [j]; this 0-i-! 1 and 0-j-1 and as the 0-i-2 of the 0-j-1
if s [i-1] == t [j-1] when, dp [i] [j] = dp [i- 1] [j-1] + dp [i-1] [j]; this case may generate a new, which may be provided by dp [i-1] [j -1] continue, and coupled dp [i-1 ] [j].
#include<bits/stdc++.h>
using namespace std;
const int mod=20010905;
string S,T;
int dp[1084594][10];
int solve() {
int ss=S.size()+1;
int st=T.size()+1;
dp[0][0]=1;
for(int i=1;i<ss;++i) {
dp[i][0]=1;
}
for(int i=1;i<ss;++i){
for(int j=1;j<=i&&j<st;++j){
if(S[i-1]==T[j-1]){
dp[i][j]=(dp[i-1][j-1]+dp[i-1][j])%mod;
}else{
dp[i][j]=dp[i-1][j];
}
}
}
return dp[ss-1][st-1];
}
int main(){
cin>>S;
transform(S.begin(),S.end(),S.begin(),::tolower);
T="iloveyou";
cout<<solve()<<endl;
return 0;
}