Compare commits

..

No commits in common. "73c713708f44f3c0d0d031f40d65def54b408f96" and "a954fc5f52d5c5456e658e62a8222578d7788a4d" have entirely different histories.

1 changed files with 10 additions and 5 deletions

View File

@ -6,7 +6,7 @@ class Lab3
public static void Main(string[] args)
{
string text = "Вухатий великий синiй слон. Яблуко в саду. Зелене яблуко? Груша. Жовта слива висить у саду!";
Console.WriteLine(text );
Console.WriteLine(text+ "-Наш текст;");
// розділяємо текст на окремі речення
string[] textSplit = text.Split(new[] { '.', '?', '!' }, StringSplitOptions.RemoveEmptyEntries);
@ -25,9 +25,14 @@ class Lab3
{
sentenceDictionary.Add(amountOfWords[i], textSplit[i]);
}
var sortedDict = sentenceDictionary.OrderBy(x => x.Key).ToDictionary(x => x.Value, x => x.Key);
Console.WriteLine(String.Join(";", sortedDict.Keys));
// збираємо відсортований текст з Dictionary відсортованих речень
string sortedText = "";
foreach (string s in sentenceDictionary.Values)
{
sortedText += $"\n{s.Trim()}";
}
Console.WriteLine(sortedText);
Console.ReadLine();
}
}
}