Skip to content

Instantly share code, notes, and snippets.

@Soulstorm50
Created December 24, 2016 12:38
Show Gist options
  • Save Soulstorm50/ac5bad9f2c6fda03dcab5cb760c2fa03 to your computer and use it in GitHub Desktop.
Save Soulstorm50/ac5bad9f2c6fda03dcab5cb760c2fa03 to your computer and use it in GitHub Desktop.
Анализ строки C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
namespace Анализ_строки
{
class Program
{
static void Main(string[] args)
{
Console.Title = "Анализ строки";
Console.WriteLine("Введите анализируемую строку");
string input = Console.ReadLine();
int all_count = input.Length;
int glas_count = Regex.Matches(input, @"[weyuioaёуеыаоэяию]", RegexOptions.IgnoreCase).Count;
int sogl_count = Regex.Matches(input, @"[qrtpsdfghjklzxcvbnmйцкнгшщзхъфвпрлджчсмтьб]", RegexOptions.IgnoreCase).Count;
int digits_count = Regex.Matches(input, @"\d", RegexOptions.IgnoreCase).Count;
int stoper_count = Regex.Matches(input, @"[.,:;!?\/]", RegexOptions.IgnoreCase).Count;
Console.WriteLine("Всего символов - {0}\nГласных - {1}\nСогласных - {2}\nЦифр - {3}\nЗнаков препинания - {4}", all_count, glas_count, sogl_count, digits_count, stoper_count);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment