hdu--2564词组缩写(要用字符串来做,最后要加上结束符)

    技术2022-05-19  20

    #include "stdio.h" #include "string.h" #include "stdlib.h" #include "math.h" int main() { int h, m, s, t, n, i,len,temp,j,k,min,min2,make; char a[100000],str[10000]; scanf("%d/n",&t); while (t--) { gets(a); len=strlen(a); i=0;j=0; while(a[i]==32) i++; if(a[i]>='a'&&a[i]<='z') str[j++]=a[i]-32; else str[j++]=a[i]; i++; while (i<len-1) { if(a[i]==32&&a[i+1]!=32) {if(a[i+1]>='a'&&a[i+1]<='z') str[j++]=a[i+1]-32; else str[j++]=a[i+1];} i++; } str[j]='/0'; puts(str); } return 0; }

     


    最新回复(0)