Difficulty answering self study homework using a dictionary
<p>Hello there again dear friends. I do not for the word of me understand what is going on in this code. I'm trying to implement a dictionary that counts the instances that a word pops up disregarding upper case or not. It keeps showing <strong>"isthis"</strong> and I dont know where its coming from. How do i rectify this?</p>

<p>The question is as such</p>

<blockquote>
  <p>Write a program that counts how many times each word from a given
  text file words.txt appears in it. The result words should be ordered by
  their number of occurrences in the text.</p>
</blockquote>

<p>Here is the code </p>

<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Text.RegularExpressions;

namespace Chapter_18_Question_3
{
    class Program
{
    static void Main(string[] args)
    {
        const string path = "words.txt";
        string line;
        using (var reader = new StreamReader(path))
        {
             line = reader.ReadToEnd();
        }

        string text = line.ToLower();
        string tmp = Regex.Replace(text, "[^a-zA-Z0-9 ]", "");
        string[] newText = tmp.Split(' '); 

        var table = new SortedDictionary&lt;string, int&gt;();
        foreach(var item in newText)
        {
            if(!table.ContainsKey(item))
            {
                table.Add(item, 1);
            }

            else
            {
                table[item] += 1;
            }
        }
        foreach (var item in table)
        {
            Console.WriteLine("The word {0} appeared {1} times",
                item.Key, item.Value);
        }

    }
}
</code></pre>

<p>My text is this:</p>

<p>"This is the TEXT. Text, text, text – THIS TEXT! Is this the text?"</p>

<p>And the output is this</p>

<blockquote>
  <p>The word  appeared 1 times</p>
  
  <p>The word is appeared 1 times</p>
  
  <p>The word isthis appeared 1 times</p>
  
  <p>The word text appeared 6 times</p>
  
  <p>The word the appeared 2 times</p>
  
  <p>The word this appeared 2 times</p>
</blockquote>