This repository has been archived on 2024-10-24. You can view files and clone it, but cannot push or open issues or pull requests.
NG_2023_Stanislav_Mykhailenko/Lesson_1/Task_4/Program.cs

26 lines
687 B
C#
Raw Normal View History

2023-03-06 12:22:05 +00:00
/*
* Lesson 1 Task 4: get two strings and concatenate them if the first one is longer, split the second one with the first character of the first string if the second one is longer, otherwise do nothing
* Author: Stanislav Mykhailenko
* License: Unlicense
*/
2023-03-06 11:52:12 +00:00
Console.Write("Enter string 1: ");
string? string1 = Console.ReadLine();
Console.Write("Enter string 2: ");
string? string2 = Console.ReadLine();
if (string1 == null || string2 == null)
{
}
else if (string1.Length > string2.Length)
Console.WriteLine(string1 + string2);
else if (string1.Length < string2.Length)
{
string[] split = string2.Split(string1[0]);
foreach (string value in split)
Console.WriteLine(value);
}