题目链接
chokudai 求子序列个数_其他

#include <iostream>
#include <cstring>
using namespace std;
const int mod = 1e9 + 7;
int pre[30], res[30];
int main()
{
      
        
	string s = "chokudai";
	for(int i = 1; i < 8; i++)
	    pre[s[i] - 'a'] = s[i-1] - 'a';
	    
	string y;
	cin>>y;
	for(int i = 0; i < y.size(); i++)
	{
      
        
		if(y[i] == 'c') res[y[i] - 'a']++;
		else res[y[i] - 'a'] += res[pre[y[i] - 'a']];
		res[y[i] - 'a'] %= mod; 
	}
	cout<<res[8];
	return 0;
}