怎么去除多余重复字母?
static void Main(string[] args)
{
string str;
char c;
int num = 0;
str = Console.ReadLine();
for (int i = 0; i < str.Length; i++)
{
c = str[i];
// Console.WriteLine(c);
if ((int)c >= 'a' && (int)c <= 'z' || (int)c >= 'A' && (int)c <= 'Z')
{
{
Console.WriteLine("{0}", c);
num++;
}
}
}
Console.Write("输入字符串中字母的个数:{0}",num);
Console.ReadKey();
}