private static void Main(string[] args) { int numTestCases = int.Parse(Console.ReadLine()); for (int testCaseNum = 1; testCaseNum <= numTestCases; testCaseNum++) { string firstString = Console.ReadLine(); string secondString = Console.ReadLine(); SuffixTree tree = new SuffixTree(); tree.ConstructTree(firstString + "$", 1); tree.ConstructTree(secondString + "@", 2); string longestSubstring = tree.FindLongestCommonSubstring("$", "@"); // tree.root.Output(); //find the longest common substring Console.WriteLine("Test {0}: {1}-{2}", testCaseNum, longestSubstring.Length, longestSubstring); } }