Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace ConsoleApplication5
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Рядок 1:");
- string fString = Console.ReadLine();
- Console.Write("Рядок 2:");
- string sString = Console.ReadLine();
- int a = sString.Length;//1
- int c = sString.LastIndexOf(" ");//2
- string lastword2 = sString.Substring(c+1, a-(c+1));
- string[] mas1 = fString.Split(' ');
- Console.Write("2: ");
- for (int i = 0; i < mas1.Length; i++)
- {
- if (string.CompareOrdinal(mas1[i], lastword2) == 0 && i < (mas1.Length) / 2)
- {Console.Write(""); }
- else
- { Console.Write(mas1[i] + " "); }
- fString = sString.Substring(0, 5) + fString;
- sString = sString.Remove(0, 5);
- Console.WriteLine(fString);
- Console.WriteLine(sString);
- int indexFirst = fString.LastIndexOf(" ") + 1;
- int indexSecond = sString.LastIndexOf(" ") + 1;
- string lastWordF = fString.Substring(indexFirst);
- string lastWordS = sString.Substring(indexSecond);
- if (lastWordF == lastWordS)
- Console.WriteLine("Words are the same");
- else
- Console.WriteLine("Words are not the same");
- Console.ReadKey();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement