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()); }
public void GetCountGcjLength2() { Analyzer analyzer = new Analyzer(); Assert.AreEqual(3, analyzer.Count("gcj", 2)); }
public void GetCountQuartzLength2() { Analyzer analyzer = new Analyzer(); Assert.AreEqual(9, analyzer.Count("quartz", 2)); }
public void GetCountAbeLength1() { Analyzer analyzer = new Analyzer(); Assert.AreEqual(4, analyzer.Count("abe", 1)); }
public void GetCountAaaaLength3() { Analyzer analyzer = new Analyzer(); Assert.AreEqual(0, analyzer.Count("aaaa", 3)); }
public void GetCountTsetseLength2() { Analyzer analyzer = new Analyzer(); Assert.AreEqual(11, analyzer.Count("tsetse", 2)); }
public void GetCountStringLength3() { Analyzer analyzer = new Analyzer(); Assert.AreEqual(4, analyzer.Count("string", 3)); }
public void GetCountStraightLength3() { Analyzer analyzer = new Analyzer(); Assert.AreEqual(11, analyzer.Count("straight", 3)); }