Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- using System.Numerics;
- namespace _2.EmojiDetector
- {
- class Program
- {
- static void Main(string[] args)
- {
- BigInteger newing = new BigInteger();
- newing.
- int coolThreshHold = 1;
- string emojiPattern = @"([\:\*]{2})([A-Z][a-z]{2,})\1";
- string input = Console.ReadLine();
- for (int i = 0; i < input.Length; i++)
- {
- if (char.IsDigit(input[i]))
- {
- int cool = int.Parse(input[i].ToString());
- }
- }
- MatchCollection validEmojis = Regex.Matches(input, emojiPattern);
- List<string> coolEmojis = new List<string>();
- foreach (Match emoji in validEmojis)
- {
- int coolness = 0;
- string current = emoji.Groups[2].Value;
- for (int i = 0; i < current.Length; i++)
- {
- coolness += (int)current[i];
- }
- if (coolness>=coolThreshHold)
- {
- coolEmojis.Add(emoji.Value);
- }
- }
- Console.WriteLine($"Cool threshold: {coolThreshHold}");
- Console.WriteLine($"{validEmojis.Count} emojis found in the text. The cool ones are:");
- Console.WriteLine(string.Join(Environment.NewLine,coolEmojis));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment