杭电OJ 2030汉字统计

#include <iostream>
#include <string>
using namespace std;
char s[10000];
int main()
{
	int T;
	cin >> T;
	getchar();
	for (int i = 0; i < T; i++)
	{
		gets_s(s);
		int num = 0;
		for (int j = 0; j < strlen(s)-1; j++)
			if ((s[j] & 0x80) && (s[j + 1] & 0x80))
			{
			num++;
			j++;
			}
		cout << num << endl;
	}
	return 0;
}

猜你喜欢

转载自blog.csdn.net/fuwu4087/article/details/80511515