Advertisement
ZloIYulik

Untitled

Oct 15th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. using System;
  2.  
  3. using System.Collections.Generic;
  4.  
  5. using System.Text;
  6.  
  7.  
  8.  
  9. namespace ConsoleApplication5
  10.  
  11. {
  12.  
  13. class Program
  14.  
  15. {
  16.  
  17. static void Main(string[] args)
  18.  
  19. {
  20.  
  21. Console.Write("Рядок 1:");
  22. string fString = Console.ReadLine();
  23. Console.Write("Рядок 2:");
  24. string sString = Console.ReadLine();
  25. int a = sString.Length;//1
  26. int c = sString.LastIndexOf(" ");//2
  27. string lastword2 = sString.Substring(c+1, a-(c+1));
  28. string[] mas1 = fString.Split(' ');
  29. Console.Write("2: ");
  30. for (int i = 0; i < mas1.Length; i++)
  31. {
  32. if (string.CompareOrdinal(mas1[i], lastword2) == 0 && i < (mas1.Length) / 2)
  33. {Console.Write(""); }
  34. else
  35. { Console.Write(mas1[i] + " "); }
  36. fString = sString.Substring(0, 5) + fString;
  37. sString = sString.Remove(0, 5);
  38. Console.WriteLine(fString);
  39. Console.WriteLine(sString);
  40. int indexFirst = fString.LastIndexOf(" ") + 1;
  41. int indexSecond = sString.LastIndexOf(" ") + 1;
  42. string lastWordF = fString.Substring(indexFirst);
  43. string lastWordS = sString.Substring(indexSecond);
  44. if (lastWordF == lastWordS)
  45. Console.WriteLine("Words are the same");
  46. else
  47. Console.WriteLine("Words are not the same");
  48. Console.ReadKey();
  49. }
  50. }
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement