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 common_end
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] firstLine = Console.ReadLine().Split(' ').ToArray();
- string[] secondLine = Console.ReadLine().Split(' ').ToArray();
- int minLength = Math.Min(firstLine.Length, secondLine.Length);
- int matchedWordsLeft = 0;
- int mathedWordsRight = 0;
- for (int i = 0; i < minLength; i++)
- {
- if (firstLine[i] == secondLine[i])
- {
- matchedWordsLeft++;
- }
- if (firstLine[firstLine.Length - 1 - i] == secondLine[secondLine.Length - 1 - i])
- {
- mathedWordsRight++;
- }
- }
- Console.WriteLine(Math.Max(matchedWordsLeft,mathedWordsRight));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement