//
// main.c
// 杭州电子科技大学
//
// Created by yonuyeung on 2021/10/12.
//汉字内码是两个字节,一个汉字占两个ASCII字符,汉字内码最高位为1,ASCII码最高位为0
因此每个汉字都是小于零的
#include<stdio.h>
#include<string.h>
int main()
{
int n,length;
scanf("%d",&n);
getchar();
while(n--){
int count=0;
char s[1000];
gets(s);
length=strlen(s);
for(int i=0;i<length;i++)
{
if(s[i]<0) count++;
}
printf("%d\n",count/2);
}
return 0;
}
2030 汉字统计(杭电)
猜你喜欢
转载自blog.csdn.net/qq_59414507/article/details/120838611
今日推荐
周排行