using System; using System.Linq; using System.Collections.Generic; class Program { static void Main(string[] args) { string a = Console.ReadLine(); string b = Console.ReadLine(); if (Judge(a, b)) { Console.WriteLine("OK"); } else { Console.WriteLine("NG"); } Console.Read(); } static bool Judge(string a, string b) { int i; string n = a; string m = b; if (!int.TryParse(a, out i) || !int.TryParse(b, out i)) { return false; } if (a != "0") { n = a.TrimStart('0'); } if (b != "0") { m = b.TrimStart('0'); } if (a != n || b != m) { return false; } if (int.Parse(a) > 12345 || int.Parse(b) > 12345) { return false; } return true; } }