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;
- class Program
- {
- static void Main(string[] args)
- {
- var regex = new Regex(@"(?<=\s|^)(:[a-z]{4,}:)(?=[,.!?\s]|$)");
- var emojies = regex.Matches(Console.ReadLine()).Select(x => x.Groups[1].Value).ToList();
- var decodedEmoji = $":{string.Join("", Console.ReadLine().Split(":").Select(x => (char)int.Parse(x)))}:";
- var emojiPower = 0;
- emojies.ForEach(emoji =>
- {
- emojiPower += emoji.Trim(':').ToCharArray().Select(x => (int)x).Sum();
- });
- if (emojies.Count > 0)
- {
- Console.WriteLine($"Emojis found: { string.Join(", ", emojies)}");
- }
- if (emojies.Any(x => x.Equals(decodedEmoji)))
- {
- emojiPower *= 2;
- }
- Console.WriteLine($"Total Emoji Power: {emojiPower}");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement