字符处理
输入一串字符,以 . 为结束,统计有a个换行符,b个at
#include<stdio.h>
#include<string.h>
int main(){
int a=0,b=0;
char c;
bool flag;
while((c=getchar())&&c!='.'){
if(c=='\n'){
a++;
}
else if(c=='a'){
flag=true;
}
else if(c=='t'){
if(flag){
b++;
flag=false;
}
}
else{
flag=false;
}
}
printf("%d个换行符,%d个at",a,b);
return 0;
}