1. #include<iostream>
    2. #include<string>
    3. #include<algorithm>
    4. using namespace std;
    5. int main() {
    6. string s[200];
    7. int i = 0; int n = 0,count=0;
    8. cin >> n;
    9. while (cin >> s[count]) {
    10. count++;
    11. }
    12. if (n > count) cout << "error" << endl;
    13. else {
    14. for (i=count-1; i>=0; i--) { // 依次后移
    15. s[i + n] = s[i];
    16. }
    17. for (i = 0; i < n; i++) { // 找到最前面的单词
    18. s[i] = s[count+i];
    19. }
    20. for (i = 0; i < count; i++) {
    21. cout << s[i]<<" ";
    22. }
    23. }
    24. }