using System.Collections.Generic;
public static void Main()
string paragraph = "El perro entro a la casa que fue hecha por su duenio para su perro. La casa es de color rojo pues es el color favorito del perro. El duenio le encanta ver al perro jugar en su casa de color rojo.";
Dictionary<string, int> wordsCount = new Dictionary<string, int>();
var words = paragraph.Split(' ');
foreach (string word in words)
if (word[word.Length - 1] == '.')
evaluatedWord = word.Remove(word.Length - 1);
if (wordsCount.ContainsKey(evaluatedWord))
wordsCount[evaluatedWord] = wordsCount[evaluatedWord] + 1;
wordsCount.Add(evaluatedWord, 1);
SortedDictionary<string,int> orderedWordsCount = new SortedDictionary<string,int>(wordsCount);
foreach (KeyValuePair<string, int> entry in orderedWordsCount)
string line = "Palabra: " + entry.Key + " | Cantidad: " + entry.Value;