1009 说反话(20分)一个循环完成
注意:cin对空格、换行符不敏感,所以使用getchar()去判断换行符。
#include<iostream>
using namespace std;
int main() {
string str;
string result;
while(cin>>str){
result=str+" "+result;
int c=getchar();
if(c=='\n')break;
}
result=result.substr(0,result.size()-1);
cout<<result;
return 0;
}