北邮OJ 132 打印字符串

北邮OJ 打印字符串

在这里插入图片描述在这里插入图片描述

#include <bits/stdc++.h>
using namespace std;
int main(){
	int t;
	scanf("%d",&t);
	while(t--){
		int count=0;
		char x,s[1000];	
		cin>>x;
		fflush(stdin);
		scanf("%s",&s); 
		for(int i=0;s[i]!='\0';i++){
			if(s[i]==x) 
			count++;
		}
		printf("%d\n",count);
	}
}

猜你喜欢

转载自blog.csdn.net/bingkuoluo_/article/details/88808515
132