天啊撸,ACM为什么总是提示我Output Limit Exceed!!!!

题目很简单,输入一个字符串要求将其中的t或者T改为对应的e或者E,并统计修改的字符数输出,
例如
输入为:
attbecTtTgh
输出为:
aeebecEeEgh
5

代码:

#include
#include
#include
using namespace std;
int main()
{
int count = 0;
char c;
while((c=getchar())!='\n')
{
if(c == 't'||c == 'T')
{
c=(c == 't')?('e'):('E');
count++;
}
cout<<c;
}
cout<<endl<<count;
return 0;
}

while循环的结束方式不对,另外题中的要求是输入、输出的是字符串,而你的程序是单个字符的输出

头文件为《iostream》和《stdio.h》

可能是while((c=getchar())!='\n')
这里,oj平台用的是什么作为输入结束的,也许是\r或者eof

Output Limit Exceed意思是产生了过多输出,基本可以判断是while((c=getchar())!='\n')的条件判断有问题,导致陷入死循环了。可以将循环结束条件改为EOF