Advertisement
YavorGrancharov

Last_3_Consecutive_Equal_Strings_II

Oct 8th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.54 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace Last_3_Consecutive_Equal_Strings_II
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             string[] arr = Console.ReadLine().Split().ToArray();
  11.  
  12.             for (int i = arr.Length - 1; i >= 0; i--)
  13.             {
  14.                 if (arr[i] == arr[i - 1] && arr[i - 1] == arr[i - 2])
  15.                 {
  16.                     Console.WriteLine("{0} {1} {2}",arr[i],arr[i],arr[i]);
  17.                     break;
  18.                 }
  19.             }
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement