Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace Emoji_Detector
- {
- class Program
- {
- static void Main(string[] args)
- {
- string line = Console.ReadLine();
- int coolThreshold = 1;
- string currentEmodji = "";
- int coolness = 0; ;
- List<string> validEmojis = new List<string>();
- List<string> coolEmodjis = new List<string>();
- for (int i = 0; i < line.Length; i++)
- {
- if (Char.IsDigit(line[i]))
- {
- coolThreshold *= int.Parse(line[i].ToString());
- }
- }
- Console.WriteLine($"Cool threshold: {coolThreshold}");
- for (int i = 0; i < line.Length - 1; i++)
- {
- if ((line[i] == '*') || (line[i] == ':'))
- {
- if (line[i] == '*')
- {
- if (line[i + 1] == '*')
- {
- for (int j = i + 2; j < line.Length - 1; j++)
- {
- if (line[j] == '*')
- {
- if (line[j + 1] == '*')
- {
- currentEmodji = line.Substring(i, j + 2 - i);
- if ((currentEmodji[2] >= 65) && (currentEmodji[2] <= 90))
- {
- validEmojis.Add(currentEmodji);
- i = j + 2;
- break;
- }
- else
- {
- i = j + 2;
- break;
- }
- }
- }
- }
- }
- }
- if (line[i] == ':')
- {
- if (line[i + 1] == ':')
- {
- for (int j = i + 2; j < line.Length - 1; j++)
- {
- if (line[j] == ':')
- {
- if (line[j + 1] == ':')
- {
- currentEmodji = line.Substring(i, j + 2 - i);
- if ((currentEmodji[2] >= 65) && (currentEmodji[2] <= 90))
- {
- validEmojis.Add(currentEmodji);
- i = j + 2;
- break;
- }
- else
- {
- i = j + 2;
- }
- }
- }
- }
- }
- }
- }
- }
- Console.WriteLine($"{validEmojis.Count} emojis found in the text. The cool ones are:");
- foreach (string Emodji in validEmojis)
- {
- for (int i = 2; i < Emodji.Length - 2; i++)
- {
- if (Char.IsLetter(Emodji[i]))
- {
- coolness += Emodji[i];
- }
- }
- if (coolness >= coolThreshold)
- {
- coolEmodjis.Add(Emodji);
- }
- coolness = 0;
- }
- foreach (var coolEmodji in coolEmodjis)
- {
- Console.WriteLine(coolEmodji);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement