Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Last_3_Consecutive_Equal_Strings
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] input = Console.ReadLine().Split(' ');
- int count = 1;
- for (int i = input.Length-1; i > 0; i--)
- {
- if (input[i] == input[i-1])
- {
- count++;
- if (count == 3)
- {
- Console.WriteLine($"{input[i]} {input[i]} {input[i]}");
- break;
- }
- }
- else
- {
- count = 1;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement