Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Reflection.Metadata;
- using System.Text.RegularExpressions;
- using System.Threading.Channels;
- namespace ConsoleApp8
- {
- class Program
- {
- static void Main(string[] args)
- {
- string patternName = @"(?<symbols>[*:]{2})(?<name>[A-Z][a-z]{2,})\1";
- string patternDigits = @"(?<digits>\d)";
- string input = Console.ReadLine();
- long coolThreshhold = 1;
- MatchCollection matches = Regex.Matches(input, patternName);
- MatchCollection matchesNumbers = Regex.Matches(input, patternDigits);
- string concatNumbers = string.Empty;
- List<string> cool = new List<string>();
- foreach (var number in matchesNumbers)
- {
- concatNumbers += number;
- }
- for (int i = 0; i < concatNumbers.Length; i++)
- {
- coolThreshhold *= int.Parse(concatNumbers[i].ToString());
- }
- foreach (Match match in matches)
- {
- if (match.Success)
- {
- long sumASCI = 0;
- foreach (var symbol in match.Groups["name"].Value)
- {
- sumASCI += symbol;
- }
- if (sumASCI >= coolThreshhold)
- {
- string addName = match.Groups["symbols"].Value + match.Groups["name"].Value +
- match.Groups["symbols"].Value;
- cool.Add(addName);
- }
- }
- }
- Console.WriteLine($"Cool threshold: {coolThreshhold}");
- Console.WriteLine($"{matches.Count} emojis found in the text. The cool ones are:");
- foreach (var coolnames in cool)
- {
- Console.WriteLine($"{coolnames}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement