Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace Application
- {
- class MainClass
- {
- protected internal static void Main()
- {
- string[] wordsOne = Console.ReadLine().Split(' ').ToArray();
- string[] wordsTwo = Console.ReadLine().Split(' ').ToArray();
- int leftCounter = 0;
- int rightsCounter = 0;
- for (int i = 0; i < Math.Min(wordsOne.Length, wordsTwo.Length); i++)
- {
- if (wordsOne[i] == wordsTwo[i])
- {
- leftCounter++;
- }
- else
- {
- break;
- }
- }
- for (int i = 0; i < Math.Min(wordsOne.Length, wordsTwo.Length); i++)
- {
- if (wordsOne[wordsOne.Length - 1 -i] == wordsTwo[wordsTwo.Length - 1 - i])
- {
- rightsCounter++;
- }
- else
- {
- break;
- }
- }
- if (rightsCounter > leftCounter)
- {
- Console.WriteLine(rightsCounter);
- }
- else
- {
- Console.WriteLine(leftCounter);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement