#include
int main()
{
printf("Enter some texts:\n");
char ch;
int ct1=0;
int ct2=0;
while((ch=getchar())!='#')/*读取,读到#停止,用感叹号替换句号,两个感叹号代替原来感叹号,报告替换次数*/
{
switch(ch)
{
case'.':
putchar('!');
++ct1;
break;
case'!':
putchar('!');
putchar('!');
++ct2;
break;
default:putchar(ch);
}
}
printf("%d replacements of .with !\n",ct1);
printf("%d replacements of !with !!\n",ct2);
return 0;
}