using System;
class Program
{
static void Main() {
string str = "12:14:36";
List<string> time_parts = new List<string>();
int pos = 0;
while ((pos = str.IndexOf(":", pos, StringComparison.Ordinal)) != -1) {
time_parts.Add(str.Substring(0, pos));
str = str.Substring(pos + 1);
}
time_parts.Add(str); // Add the seconds
if (time_parts.Count != 3) {
Console.WriteLine("Invalid time format");
}
int hours = int.Parse(time_parts[0]);
int minutes = int.Parse(time_parts[1]);
int seconds = int.Parse(time_parts[2]);
Console.WriteLine(hours + ":" + minutes + ":" + seconds);
}
}
/*
run:
12:14:36
*/