Miki1337

Untitled

Apr 4th, 2020
566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using System.Text;
  4. using System.Text.RegularExpressions;
  5. using System.Threading.Tasks;
  6. using System.Numerics;
  7.  
  8.  
  9. namespace _2.EmojiDetector
  10. {
  11. class Program
  12. {
  13. static void Main(string[] args)
  14. {
  15. BigInteger newing = new BigInteger();
  16. newing.
  17. int coolThreshHold = 1;
  18. string emojiPattern = @"([\:\*]{2})([A-Z][a-z]{2,})\1";
  19. string input = Console.ReadLine();
  20. for (int i = 0; i < input.Length; i++)
  21. {
  22. if (char.IsDigit(input[i]))
  23. {
  24. int cool = int.Parse(input[i].ToString());
  25.  
  26. }
  27.  
  28. }
  29. MatchCollection validEmojis = Regex.Matches(input, emojiPattern);
  30. List<string> coolEmojis = new List<string>();
  31. foreach (Match emoji in validEmojis)
  32. {
  33. int coolness = 0;
  34. string current = emoji.Groups[2].Value;
  35. for (int i = 0; i < current.Length; i++)
  36. {
  37. coolness += (int)current[i];
  38. }
  39. if (coolness>=coolThreshHold)
  40. {
  41. coolEmojis.Add(emoji.Value);
  42. }
  43. }
  44. Console.WriteLine($"Cool threshold: {coolThreshHold}");
  45. Console.WriteLine($"{validEmojis.Count} emojis found in the text. The cool ones are:");
  46. Console.WriteLine(string.Join(Environment.NewLine,coolEmojis));
  47.  
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment