Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _01._Largest_Common_End
- {
- class LargestCommonEnd
- {
- static void Main(string[] args)
- {
- string[] firstArr = Console.ReadLine().Split();
- string[] secondArr = Console.ReadLine().Split();
- int shorter = Math.Min(firstArr.Length, secondArr.Length);
- int leftCount = 0;
- int rigthCount = 0;
- for (int i = 0; i < shorter; i++)
- {
- if (firstArr[i] == secondArr[i])
- {
- leftCount++;
- }
- if (firstArr[firstArr.Length - 1 - i] == secondArr[secondArr.Length - 1 - i])
- {
- rigthCount++;
- }
- }
- Console.WriteLine(Math.Max(leftCount, rigthCount));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment