using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Magatro { static int[] cnt = new int[10]; static void Main() { string s = Console.ReadLine(); Counter(s); int n=0, m=0; int[] ans = { 20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841 }; for(int i = 0; i < 10; i++) { if (cnt[i] < ans[i]) { n = i; } if (ans[i] < cnt[i]) { m = i; } } Console.WriteLine("{0} {1}", m, n); } static void Counter(string s) { for(int i = 0; i < 10; i++) { string q = s; s = s.Replace(i.ToString(), ""); cnt[i] = q.Length - s.Length; } } }