Esempio n. 1
0
        public static void Main(string[] args)
        {
            string inputname = args[0];
            string outputname = args[1];

            string[] lines = File.ReadAllLines(inputname);

            int ncases = int.Parse(lines[0]);
            int nline = 0;
            IList<string> results = new List<string>();
            Analyzer analyzer = new Analyzer();

            for (int k = 0; k < ncases; k++)
            {
                Console.WriteLine(string.Format("Solving Case #{0}", k + 1));
                nline++;
                string[] words = lines[nline].Split(' ');
                string text = words[0];
                int length = int.Parse(words[1]);
                int count = analyzer.Count(text, length);
                results.Add(string.Format("Case #{0}: {1}", k + 1, count));
            }

            File.WriteAllLines(outputname, results.ToArray());
        }
Esempio n. 2
0
 public void GetCountGcjLength2()
 {
     Analyzer analyzer = new Analyzer();
     Assert.AreEqual(3, analyzer.Count("gcj", 2));
 }
Esempio n. 3
0
 public void GetCountQuartzLength2()
 {
     Analyzer analyzer = new Analyzer();
     Assert.AreEqual(9, analyzer.Count("quartz", 2));
 }
Esempio n. 4
0
 public void GetCountAbeLength1()
 {
     Analyzer analyzer = new Analyzer();
     Assert.AreEqual(4, analyzer.Count("abe", 1));
 }
Esempio n. 5
0
 public void GetCountAaaaLength3()
 {
     Analyzer analyzer = new Analyzer();
     Assert.AreEqual(0, analyzer.Count("aaaa", 3));
 }
Esempio n. 6
0
 public void GetCountTsetseLength2()
 {
     Analyzer analyzer = new Analyzer();
     Assert.AreEqual(11, analyzer.Count("tsetse", 2));
 }
Esempio n. 7
0
 public void GetCountStringLength3()
 {
     Analyzer analyzer = new Analyzer();
     Assert.AreEqual(4, analyzer.Count("string", 3));
 }
Esempio n. 8
0
 public void GetCountStraightLength3()
 {
     Analyzer analyzer = new Analyzer();
     Assert.AreEqual(11, analyzer.Count("straight", 3));
 }