游客 Signup | Login
中文 | En

1874 - C语言考试练习题_保留字母

编一个程序,输入一个字符串,将组成字符串的所有非英文字母的字符删除后输出。

Input

一个字符串,长度不超过80个字符

Output

删掉非英文字母后的字符串。

Examples

Input

abc123+xyz.5

Output

abcxyz

Solution C++

#include<iostream>
#include<string>
#include<cctype>
using namespace std;
int main()
{
	string from,to;
	getline(cin,from);
	int len=from.size(),j=0;
	for (int i=0; i<len; i++)
		if (isalpha(from[i])) to+=from[i];
	cout<<to<<endl;
	return 0;
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题