C语言实验——保留字母
Time Limit: 1000 ms Memory Limit: 65536 KiB
Problem Description
编一个程序,输入一个字符串,将组成字符串的所有非英文字母的字符删除后输出。
Input
一个字符串,长度不超过80个字符。
Output
删掉非英文字母后的字符串。
Sample Input
abc123+xyz.5
Sample Output
abcxyz
Hint
Source
ZJGSU
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace test1
{
class Program
{
static void Main(string[] args)
{
string s;
s = Console.ReadLine();
int i, j=0;
for(i=0;i<s.Length;i++)
{
char c = s[i];
if((c>='a'&&c<='z')||(c>='A'&&c<='Z'))
{
Console.Write(c);
}
if(i==s.Length-1)
{
Console.WriteLine();
}
}
}
}
}