汉字的ascii码是小于0的
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
int n;
char str[1000];
while(scanf("%d",&n)!=EOF){
getchar();
for(int i = 1;i<=n;i++)
{
gets(str);
int count = 0;
int len = strlen(str);
for(int j = 0;j<len;j++)
{
if(str[j]<0)//统计ascii码小于0的个数,一个汉字占两个字节,所以最后要除以2
count++;
}
printf("%d\n",count/2);
}
}
}