Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.Text.RegularExpressions;
- using System.Runtime.InteropServices;
- using System.Data;
- using System.IO;
- namespace _02._Boss_Rush
- {
- class Program
- {
- static void Main(string[] args)
- {
- Regex word = new Regex(@"(::|\*\*)(?<word>[A-Z][a-z]{2,})\1");
- Regex digit = new Regex(@"[0-9]");
- List<string> coolest = new List<string>();
- string input = Console.ReadLine();
- int cool = 1;
- MatchCollection digits = digit.Matches(input);
- foreach (Match item in digits)
- {
- if (item.Success)
- {
- int d = int.Parse(item.Value);
- cool *= d;
- }
- }
- MatchCollection words = word.Matches(input);
- foreach (Match item in words)
- {
- if (item.Success)
- {
- int count = 0;
- string threshold = item.Groups["word"].Value;
- string add = item.Value;
- char[] wealth = threshold.ToCharArray();
- foreach (char stuff in wealth)
- {
- count += stuff;
- }
- if (count >= cool)
- {
- coolest.Add(add);
- }
- }
- }
- Console.WriteLine($"Cool threshold: {cool}");
- Console.WriteLine($"{words.Count} emojis found in the text. The cool ones are:");
- if (coolest.Count > 0)
- {
- Console.WriteLine(string.Join(Environment.NewLine, coolest));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement