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