#include <iostream> using namespace std; bool sf(char c){ if((c>'a'&&c<'z')||(c>'A'&&c<'Z')){ return true; } else return false; } int main(){ string s; while(getline(cin,s)){ string s1=""; for(int i=0;i<s.size();i++){ if(sf(s[i])==true){ s1=s[i]+s1; } else{ cout<<s1<<s[i]; s1=""; } } cout<<s1<<endl; } return 0; } |
Double click to view unformatted code.