B-1009

来源:互联网 发布:mysql重置初始密码 编辑:程序博客网 时间:2024/06/01 09:37
#include<cstdio>#include<vector>#include<string>#include<string.h>#include<iostream>using namespace std;vector<string> V;int size = 0;char s[90];int main(){        while(gets(s)){        int len = strlen(s);        string str = "";        for(int i = 0; i < len; i++){            if(s[i]!=' ') str+=s[i];            else{                //cout<<str<<endl;                V.push_back(str); size++; str = "";            }        }        V.push_back(str); size++;         int first = 0;        for(int i = size-1; i >= 0; i--){            if(first==0){                cout<<V[i]; first = 1;            }            else cout<<" "<<V[i];        }        cout<<endl;    }    return 0;}
原创粉丝点击