12345678910111213141516171819202122232425262728293031 |
- //
- // Created by jal on 2019-05-02.
- //
- #include<bits/stdc++.h>
- using namespace std;
- int main(){
- string s;
- while(getline(cin, s)){
- int b = 0, e = 0;
- for(int i = 0; i < s.size(); i++){
- if(i == 0){
- if(isalpha(s[i])){
- b = i;
- }
- }
- else if (not isalpha(s[i-1]) && isalpha(s[i])){
- b = i;
- }
- if(isalpha(s[i])){
- e = i+1;
- }else{
- if(b != e){
- reverse(s.begin()+b, s.begin()+e);
- }
- b = e = i;
- }
- }
- cout << s << endl;
- }
- }
|