Работа со строками C#

Рейтинг: 0Ответов: 0Опубликовано: 12.03.2023

Вот такое задание: Ask for two different strings. Then - if string1 has more symbols than string2, return me their concated result. Else - split the longest string with first symbol of the shortest string and if it's possible return me the result. And if they are equal - let's just return some void

Я сделал для варианата если первая строка больше второй и если они равны... Но не могу понять как реализовать для варианта если вторая строка больше первой?

Вот мой пример кода:

Console.Write("Write first string: ");
string str1;
str1 = Console.ReadLine();
Console.Write("Write second string: ");
string str2;
str2 = Console.ReadLine();
int len1 = str1.Length;
int len2 = str2.Length;
if (len1 > len2) {
    string SummStr = str1 + " " + str2;
    Console.WriteLine($"Result: {SummStr}");
}

else if (len2 > len1){

}

else if (len1 == len2) {
    Console.WriteLine("Result: NULL");
}

Ответы

Ответов пока нет.