title: convert char dictionary to string dictionary
body: <p>I have been given a homework with the following statement: </p>
  
  <blockquote>
    <p>Write a program which counts all characters in a string except space (' '). 
    Print all occurrences in the following format:</p>
  
  <pre><code>{char} -&gt; {occurrences}
  </code></pre>
  </blockquote>
  
  <p>I wrote the program in char, but i keep getting a timeout error when i submit it in their homework-system. Here is my code:</p>
  
  <pre><code>SortedDictionary&lt;char, int&gt; text = new SortedDictionary&lt;char, int&gt;();
  char[] characters = Console.ReadLine() 
      .Where(x =&gt; !Char.IsWhiteSpace(x))
      .ToArray();
  foreach (var character in characters)
  {
      if (text.ContainsKey(character))
      {
          text[character]++;
      }
      else
      {
          text.Add(character, 1);
      }
  }
  foreach (var character in text.OrderByDescending(x =&gt; x.Value))
  {
      Console.WriteLine($"{character.Key} -&gt; {character.Value}");
  }
  </code></pre>
  
  <p>I can't get my head around on how to read it as a string and still get the result. Here is an example: </p>
  
  <pre><code>"text text text" = t -&gt; 6 e -&gt; 3 x -&gt; 3
  </code></pre>