View Code of Problem 114

#include <sstream>
#include <string>
#include <cstdio>
#include <iostream>

using namespace std;

int main(){
	string word;
	while(getline(cin,word)){
		
		int len=word.length();
		string st1;
		for(int i=0;i<len;i++){
			if((word[i]>='A'&&word[i]<='Z')||(word[i]>='a'&&word[i]<='z')){//字母
				st1=word[i]+st1;
			}
			else{
				cout<<st1<<word[i];
				st1.clear();
			} 
		}
		cout<<st1<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 114