#include<bits/stdc++.h>
using namespace std;
int main(){
	string s,f,l="";
	int t=0,n,m,p=s.size();
	cin>>n>>m>>s;
for(int i=0;i<m;i++){
	cin>>f;
	for(int j=0;j<p-2;j++){
	
		if(f[0]==s[j]&&f[1]==s[j+1]&&f[2]==s[j+2]){
			t++;
		}
	}
	if(f[0]==s[n-2]&&f[1]==s[n-1]&&f[2]==s[0]){
		t++;
	}
	else if(f[0]==s[n-1]&&f[1]==s[0]&&f[2]==s[1]){
		t++;
	}
}
	cout<<t;
	}

1 条评论

  • @ 2024-7-15 17:09:54

    嗨嗨害,还好试了一下,这是坑人的

    • 1

    信息

    ID
    990
    时间
    1000ms
    内存
    256MiB
    难度
    4
    标签
    递交数
    36
    已通过
    13
    上传者