//15 string wod = "00:00-01:00,00:30-02:30,01:30-03:00,02:00-04:00,02:30-05:00"; string[] schel = wod.Split(','); int[] time1 = new int[24]; foreach (string schedule in schel) { string[] times = schedule.Split('-'); string[] startTime = times[0].Split(':'); string[] endTime = times[1].Split(':'); int hour1 = int.Parse(startTime[0]); int hour2 = int.Parse(endTime[0]); for (int i = hour1; i < hour2; i++) { time1[i]++; } } int maxTime = 0; for (int i = 0; i < 24; i++) { if (time1[i] > maxTime) { maxTime = time1[i]; } } Console.WriteLine("Максимальное количество касс работает в интервале: "); for (int i = 0; i < 24; i++) { if (time1[i] == maxTime) { Console.WriteLine("{0:00}:00 - {1:00}:00", i, i + 1); } }