Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.80 KB | None | 0 0
  1.  var input = Console.ReadLine();
  2.             var pattern = @"\.\s[A-Z]";
  3.             var regex = new Regex(pattern);
  4.             var wordRgx = new Regex(@"\w");
  5.             List<string> outputLines = new List<string>();
  6.  
  7.             while (input != "Worm Ipsum")
  8.             {
  9.                 bool isMatch = regex.IsMatch(input);
  10.  
  11.                 if (!isMatch)
  12.                 {
  13.                     var words = wordRgx.Matches(input).Cast<Match>().Select(x => x.Value).ToArray();
  14.                     foreach (var word in words)
  15.                     {
  16.                         var charDictionary = new Dictionary<char, int>();
  17.  
  18.                         foreach (char ch in word)
  19.                         {
  20.                             if (!charDictionary.ContainsKey(ch))
  21.                             {
  22.                                 charDictionary.Add(ch, 0);
  23.                             }
  24.                             charDictionary[ch]++;
  25.                         }
  26.                         var maxCharOccurance = charDictionary.Max(x => x.Value);
  27.                         var maxChar = charDictionary.Where(x => x.Value == maxCharOccurance).First().Key;
  28.  
  29.                         if (maxCharOccurance >= 2)
  30.                         {
  31.                             var wordLength = word.Length;
  32.                             var newWord = new string(maxChar, wordLength);
  33.                             outputLines =
  34.                         }
  35.                     }
  36.                 }
  37.  
  38.  
  39.                 input = Console.ReadLine();
  40.             }
  41.             for (int i = 0; i < lines.Count; i++)
  42.             {
  43.                 if (lines[i].Contains)
  44.                 {
  45.  
  46.                 }
  47.             }
  48.             foreach (var line in lines)
  49.             {
  50.                 Console.WriteLine(line);
  51.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement