using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace tongjizifu
{
class Program
{
static void Main(string[] args)
{
int l=0, m=0, n=0,k=0;
Console.WriteLine("请输入一个字符串");
string str = Console.ReadLine();
for(int i=0;i<str.Length;i++)
{
if (str[i] >= 97 && str[i] <= 122)
{
l++;
}
else if (str[i] >= 65 && str[i] <= 90)
{
m++;
}
else if(str[i] >= 49 && str[i] <= 57)
{
n++;
}
else
{
k++;
}
}
Console.WriteLine("小写字母个数为{0}",l);
Console.WriteLine("大写字母个数为{0}", m);
Console.WriteLine("数字个数为{0}", n);
Console.WriteLine("其他字符为{0}", k);
Console.ReadLine();
}
}
}
08-04
09-02
667