Console.WriteLine("Введіть рядок: ");
string inputString = Console.ReadLine();
string result = ReplaceSpacesWithUnderscores(inputString);
Console.WriteLine("Результат: ");
Console.WriteLine(result);
Console.WriteLine("Натисніть Enter, щоб завершити програму.");
static string ReplaceSpacesWithUnderscores(string text)
return text.Replace(" ", "_");