using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;


public class DigitalDisplay
{
	public int waysToInterpret(string display)
	{
		string[] d = display.Split(':');
		int[] dd = new int[3];
		int h = 0;
		for (int i = 0; i < 3; i++)
		{
			dd[i] = int.Parse(d[i]);
			if (dd[i] <= 12 && dd[i] >= 1)
				h++;
			if (dd[i] > 59 || dd[i] < 0)
				return 0;
		}

		return h * 2;
	}

	// BEGIN KAWIGIEDIT TESTING
	// Generated by KawigiEdit 2.1.4 (beta) modified by pivanof
	#region Testing code generated by KawigiEdit
	[STAThread]
	private static Boolean KawigiEdit_RunTest(int testNum, string p0, Boolean hasAnswer, int p1) {
		Console.Write("Test " + testNum + ": [" + "\"" + p0 + "\"");
		Console.WriteLine("]");
		DigitalDisplay obj;
		int answer;
		obj = new DigitalDisplay();
		DateTime startTime = DateTime.Now;
		answer = obj.waysToInterpret(p0);
		DateTime endTime = DateTime.Now;
		Boolean res;
		res = true;
		Console.WriteLine("Time: " + (endTime - startTime).TotalSeconds + " seconds");
		if (hasAnswer) {
			Console.WriteLine("Desired answer:");
			Console.WriteLine("\t" + p1);
		}
		Console.WriteLine("Your answer:");
		Console.WriteLine("\t" + answer);
		if (hasAnswer) {
			res = answer == p1;
		}
		if (!res) {
			Console.WriteLine("DOESN'T MATCH!!!!");
		} else if ((endTime - startTime).TotalSeconds >= 2) {
			Console.WriteLine("FAIL the timeout");
			res = false;
		} else if (hasAnswer) {
			Console.WriteLine("Match :-)");
		} else {
			Console.WriteLine("OK, but is it right?");
		}
		Console.WriteLine("");
		return res;
	}
	public static void m1(string[] args) {
		Boolean all_right;
		all_right = true;
		
		string p0;
		int p1;
		
		// ----- test 0 -----
		p0 = "21:23:01";
		p1 = 2;
		all_right = KawigiEdit_RunTest(0, p0, true, p1) && all_right;
		// ------------------
		
		// ----- test 1 -----
		p0 = "00:00:00";
		p1 = 0;
		all_right = KawigiEdit_RunTest(1, p0, true, p1) && all_right;
		// ------------------
		
		// ----- test 2 -----
		p0 = "01:02:03";
		p1 = 6;
		all_right = KawigiEdit_RunTest(2, p0, true, p1) && all_right;
		// ------------------
		
		// ----- test 3 -----
		p0 = "59:59:01";
		p1 = 2;
		all_right = KawigiEdit_RunTest(3, p0, true, p1) && all_right;
		// ------------------
		
		// ----- test 4 -----
		p0 = "01:01:59";
		p1 = 4;
		all_right = KawigiEdit_RunTest(4, p0, true, p1) && all_right;
		// ------------------
		
		// ----- test 5 -----
		p0 = "06:35:85";
		all_right = KawigiEdit_RunTest(5, p0, false, p1) && all_right;
		// ------------------
		
		if (all_right) {
			Console.WriteLine("You're a stud (at least on the example cases)!");
		} else {
			Console.WriteLine("Some of the test cases had errors.");
		}
	}
	#endregion
	// END KAWIGIEDIT TESTING
}
//Powered by KawigiEdit 2.1.4 (beta) modified by pivanof!
