题解 | #句子逆序#
句子逆序
https://www.nowcoder.com/practice/48b3cb4e3c694d9da5526e6255bb73c3
#include <iostream> using namespace std; int main() { string s[1001]; int length=0; while(cin>>s[length++]) { if(cin.get()=='\n') { break; } }; for(int i=length-1;i>-1;i--) { if(i) { cout<<s[i]<<' '; } else { cout<<s[i]; } } }