dxeqtr

Untitled

Jan 8th, 2021
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace _03.LongestBlock
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. string input = Console.ReadLine();
  12.  
  13. string maxChar = new string(input
  14. .Select((x, index) => input.Substring(index)
  15. .TakeWhile(y => y == x))
  16. .OrderByDescending(x => x.Count())
  17. .First().ToArray());
  18.  
  19. Console.WriteLine(maxChar);
  20.  
  21. }
  22. }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment