Problem:
Score : 100 points

Problem Statement

Two deer, AtCoDeer and TopCoDeer, are playing a game called Honest or Dishonest.
In this game, an honest player always tells the truth, and an dishonest player always tell lies.
You are given two characters a and b as the input. Each of them is either H or D, and carries the following information:

If a=H, AtCoDeer is honest; if a=D, AtCoDeer is dishonest.
If b=H, AtCoDeer is saying that TopCoDeer is honest; if b=D, AtCoDeer is saying that TopCoDeer is dishonest.

Given this information, determine whether TopCoDeer is honest.

Constraints

a=H or a=D.

b=H or b=D.

Input

The input is given from Standard Input in the following format:

a b

Output

If TopCoDeer is honest, print H. If he is dishonest, print D.

Sample Input 1

H H

Sample Output 1

H

In this input, AtCoDeer is honest. Hence, as he says, TopCoDeer is honest.

Sample Input 2

D H

Sample Output 2

D

In this input, AtCoDeer is dishonest. Hence, contrary to what he says, TopCoDeer is dishonest.

Sample Input 3

D D

Sample Output 3

H

Solution in C# (Mono 4.6.2.0) (judge verdict: Runtime Error)

using System;
using System.Collections.Generic;
using System.Linq;

public class Program {
	public static void Main() {
		new Calc().calc();
	}
	public class Calc {
		public Calc() { }
		public void calc() {
			int X = int.Parse(Console.ReadLine());
			var list = new List<node>();
			list.Add(new node(0, 0));
			int homeTime = 0;
			bool t = true;
			while (t) {
				var tmp = new List<node>();
				foreach (var item in list) {
					var check = item.makeChildren();
					if (check.FindIndex(_=>_.Node==X)!=-1) { t = false;break; }
					tmp.AddRange(check);
				}
				homeTime++;
				list = tmp;
			}
			Console.WriteLine(homeTime);
		}
		public class node {
			public int Node { get; set; }
			public int Time { get; set; }
			public node(int time,int node) {
				Node = node;Time = time;
			}
			public List<node> makeChildren() {
				var rt = new List<node>();
				rt.Add(new node(Time + 1, Node - (Time+1)));
				rt.Add(new node(Time + 1, Node + (Time+1)));
				rt.Add(new node(Time + 1, Node));
				return rt;
			}
		}
	}
}