using System;
using System.Linq;
namespace ConsoleApplication1
{
internal class Program
{
public static void Main(string[] args)
{
var str = System.Console.ReadLine();
var result = CategorizeCharactersFromString(str);
foreach (var t in result)
{
Console.WriteLine(t);
}
}
private static int[] CategorizeCharactersFromString(string sourceStr)
{
const string specials = "~!@#$%^&*()_+{}:\"<>?";
var upperCount = sourceStr.Count(char.IsUpper);
var lowerCount = sourceStr.Count(char.IsLower);
var digitsCount = sourceStr.Count(char.IsDigit);
var specialsCount = sourceStr.Count(x => specials.Contains(x));
return new[] {upperCount, lowerCount, digitsCount, specialsCount};
}
}
}
Comments
Leave a comment