Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The specified TargetFramework 'net10.0' is invalid as .NET 10 has not been released. This will prevent the project from being built. You should use a valid and supported .NET version, for example, net8.0 which is the latest Long-Term Support (LTS) version.

    <TargetFramework>net8.0</TargetFramework>

<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace Lab1;
class Program{
static void Main(string[] args){
string filePath = "input.txt";
string originalText = ReadFromFile(filePath);
Console.WriteLine("=== Исходный текст из файла ===");
Console.WriteLine(originalText);
Console.WriteLine("\n=== Обработанный текст ===");
Console.WriteLine(ProcessText(originalText));
}
static string ProcessText(string text)
{
var resultBuilder = new System.Text.StringBuilder();
for (int i = 0; i < text.Length - 1; i++)
{
if (text[i] == ' ' && text[i + 1] == '-')
{
int startIndex = i;
int endIndex = i;
while (endIndex < text.Length && text[endIndex] != '.' && text[endIndex] != '!' && text[endIndex] != '?')
{
endIndex++;
}

resultBuilder.Append(text, startIndex, endIndex - startIndex);
i = endIndex - 1;
}
}
return " " + resultBuilder.ToString();
}


static string ReadFromFile(string filepath)
{
return File.ReadAllText(filepath);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fasfdasf - asfsaasfafsfsa.
asfasfasf - asfasfafsfsa.
afsrehgre fwef ewfwefwef.
fewefwe - wef wef wef.