title: How to sort the time
body: <p>I am trying to write a program, which sort the time in very optimized manner.Time is in the format <code>HH:MM:SS</code> I read data from <code>file.txt</code>  and the data in file is as below :</p>
  
  <pre><code>01:22:15 07:35:35 11:03:35 08:45:37 16:20:23 14:10:48 11:41:44 23:20:14 07:18:21 15:48:01 19:32:44 05:27:52 00:08:02 08:44:07 19:06:02 23:59:34 17:27:26
  12:38:23 22:39:18 07:25:32 08:43:52
  </code></pre>
  
  <p>I have to read it line by line and print the sorted output line by line. I initially thought of using <strong>Dictionary</strong> and assigning HH (Hours) to the key and order it by key but the **problem is, What if two Hours are same (i mean 12:56:59 already exist by key <code>12</code> and again i try to add 12:23:44 by key <code>12</code> ** Definitely exception).</p>
  
  <p>My try to do this is :</p>
  
  <pre><code>class Program
      {
          static void Main(string[] args)
          {
              using (StreamReader reader = File.OpenText("C:\\Users\\ACER\\Desktop\\KT-iNDIA\\zExtra\\Bookprprn\\testCodeEval\\testCodeEval\\file.txt"))
  
                  while (!reader.EndOfStream)
                  {
                      string line = reader.ReadLine();
                      if (null != line)
                      {
                          Dictionary&lt;string, string&gt; dictHH = new Dictionary&lt;string, string&gt;();
  
                          string[] digits = line.Split(new char[] { ' ', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                          foreach (string digit in digits)
                          {
                              string[] eachdigit = digit.Split(new char[] { ':', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                              dictHH.Add(eachdigit[0], eachdigit[1] + " " + eachdigit[2]);
                          }
  
                          foreach (KeyValuePair&lt;string, string&gt; ch in dictHH.OrderBy(k =&gt; k.Key).Reverse())
                          {
                              Console.Write("{0} {1}    ", ch.Key, ch.Value);
                          }
                      }
                      Console.WriteLine("");
                  }
              Console.ReadKey();
          }
      }
  </code></pre>
  
  <p>How to solve the issue ? </p>