#include<stdio.h> #include<string.h> int main() { int n,tab,blank,t,i; char s[110]; scanf("%d",&t); getchar(); while(t--) { blank=0; tab=0; while(1) { gets(s); if(strcmp(s,"##")==0) break; n=strlen(s); for(i=0;i<n;i++) { if(s[i]=='\t') { tab++; blank+=4; } else if(s[i]==' ') blank++; } } printf("%d tab(s) replaced\n%d trailing space(s) removed\n",tab,blank); } return 0; } |
Double click to view unformatted code.