using System.Collections.Generic;
public static void Main()
List<OpeningHour> openings = new List<OpeningHour>(){
Dictionary<string, List<int>> groupByHour = new Dictionary<string, List<int>>();
for(var i=0;i<openings.Count;i++){
var opening = openings[i];
if(!groupByHour.ContainsKey(opening.Hour)){
groupByHour[opening.Hour] = new List<int>();
var val = groupByHour[opening.Hour];
Dictionary<string, List<int>> groupByDiff = new Dictionary<string, List<int>>();
foreach(var key in groupByHour.Keys){
var list = groupByHour[key];
for(var i=0;i<list.Count;i++){
var currentKey = key+index;
if(!groupByDiff.ContainsKey(currentKey)){
groupByDiff[currentKey] = new List<int>();
var val = groupByDiff[currentKey];
if(i+1 !=list.Count && list[i+1]-list[i] != 1){
var orderList = new Dictionary<int, string>();
foreach(var key in groupByDiff.Keys){
var list = groupByDiff[key];
var begin = openings[list.Min()];
var end = openings[list.Max()];
var text = begin.Day+ " till "+end.Day+ " : "+begin.Hour;
orderList.Add(list.Max(), text);
var orderKey = orderList.Keys.AsEnumerable().ToList();
foreach(var key in orderKey){
Console.WriteLine(orderList[key]);
public string Day {get;set;}
public string Hour {get;set;}