#include<bits/stdc++.h> using namespace std; int main(){ string str; char a[100] = {0}; getline(cin,str); int t = 0; for(int i = 0 ; i < str.size(); i++){ if(isalpha(str[i])){ int j = i; while (isalpha(str[j])) j++; for(int k = j - 1 ; k >= i; k--){ a[t++] = str[k]; } i = j-1; } else a[t++] = str[i]; } for(int i = 0; i < t; i++){ cout << a[i]; } } |
Double click to view unformatted code.