View Code of Problem 114

#include <bits/stdc++.h>
using namespace std;

int main()
{
	string s;
	while(getline(cin,s))
	{
		string str;
		//cout<<s;
		for(int i=0;i<s.size();i++)
		{
			
			if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z'))
			{
			//	cout<<s[i];
				str=str+s[i];
				//cout<<str;
			}
			else
			{
				reverse(str.begin(),str.end());
				cout<<str<<s[i];
				str="";
			}
		}
		reverse(str.begin(),str.end());
				cout<<str;
		cout<<endl;
	}
	return 0;
 } 

Double click to view unformatted code.


Back to problem 114