Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _03.LongestBlock
- {
- class Program
- {
- static void Main(string[] args)
- {
- string input = Console.ReadLine();
- string maxChar = new string(input
- .Select((x, index) => input.Substring(index)
- .TakeWhile(y => y == x))
- .OrderByDescending(x => x.Count())
- .First().ToArray());
- Console.WriteLine(maxChar);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment