| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- namespace D2._2
- {
- class Program
- {
- static void Main(string[] args)
- {
- if (args.Length < 1) return;
- if (File.Exists(args[0]) == false) return;
- var file = File.OpenText(args[0]);
- var list = new List<string>();
- string code = null;
- do
- {
- var line = file.ReadLine();
- if (line == null) break;
- foreach (var l in list)
- {
- int diffCars = 0;
- string c = string.Empty;
- for (int i = 0; i < l.Length; i++)
- {
- if (l[i] != line[i]) diffCars++;
- else c += l[i];
- if (diffCars >= 2) break;
- }
- if (diffCars == 1)
- {
- code = c;
- break;
- };
- }
- list.Add(line);
- } while (code == null);
- Console.WriteLine(code);
- }
- }
- }
|