Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _11.Equal_Sums
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. List<int> numbers = Console.ReadLine().Split().Select(int.Parse).ToList();
  14.  
  15. int count = 1;
  16. int lenght = 1;
  17. int index = 0;
  18. for (int i = 0; i < numbers.Count - 1; i++)
  19. {
  20. if (numbers[i] == numbers[i + 1])
  21. {
  22. count++;
  23. }
  24. if (count > lenght)
  25. {
  26. lenght = count;
  27. index = numbers[i];
  28. }
  29. if (numbers[i] != numbers[i + 1])
  30. {
  31. count = 1;
  32. }
  33. }
  34. int[] output = new int[lenght];
  35. for (int i = 0; i < output.Length; i++)
  36. {
  37. output[i] = index;
  38. Console.Write(string.Join(" ",output[i] + " "));
  39. }
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement