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 ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int firstNum = int.Parse(Console.ReadLine());
- int secondNum = int.Parse(Console.ReadLine());
- int firstDelimeter = 10;
- int secondDelimeter = 10;
- int count = 0;
- int multyply = 10;
- int a = 0;
- while (true)
- {
- int lastDigitFirst = (firstNum % firstDelimeter);
- int lastDigitSecond = (secondNum % secondDelimeter);
- if (a > 0)
- {
- lastDigitSecond = (secondNum % secondDelimeter) / multyply;
- multyply = multyply * 10;
- }
- if (lastDigitSecond == lastDigitFirst)
- {
- firstNum = firstNum / 10;
- multyply = 10;
- secondDelimeter = 10;
- a = -1;
- }
- else
- {
- secondDelimeter = secondDelimeter * 10;
- }
- if (firstNum == 0)
- {
- count++;
- break;
- }
- if (multyply > 1000000000)
- {
- break;
- }
- a++;
- }
- if (count == 1)
- {
- Console.WriteLine("Yes");
- }else
- {
- Console.WriteLine("No");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment