AtCoder Beginner Contest 056 - HonestOrDishonest

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-----
H H

-----Sample Output-----
H

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

Source: atcoder | Difficulty: EASY


Solutions:
[a, b] = input().split()
if a == b:
	print('H')
else:
	print('D')


(A, B) = input().split()
print('H') if A == 'D' and B == 'D' or (A == 'H' and B == 'H') else print('D')


(H, D) = (1, 2)
print('H' if eval(input().replace(' ', '+')) % 2 == 0 else 'D')


(a, b) = input().split()
print('H' if a == 'H' and b == 'H' or (a == 'D' and b == 'D') else 'D')


(a, t) = input().split()
if a == t:
	print('H')
else:
	print('D')


a = input()
if a[0] != a[2]:
	print('D')
else:
	print('H')


s = input().split()
if s[0] == s[1]:
	print('H')
else:
	print('D')


(a, b) = input().split()
if a == 'H':
	if b == 'H':
		print('H')
	elif b == 'D':
		print('D')
elif a == 'D':
	if b == 'H':
		print('D')
	elif b == 'D':
		print('H')


(A, B) = [s == 'H' for s in input().split()]
print(['H', 'D'][A ^ B])


(a, b) = map(str, input().split())
print('H' if a == b else 'D')


(a, b) = input().split()
hd = 'HD'
if a == 'H':
	print(b)
else:
	print(hd[hd.index(b) - 1])


(a, b) = input().split()
print(['D', 'H'][a == b])


(a, b) = input().split()
if a == 'H' and b == 'H':
	print('H')
elif a == 'H' and b == 'D':
	print('D')
elif a == 'D' and b == 'H':
	print('D')
else:
	print('H')


(a, b) = list(map(str, input().split()))
if a == 'H':
	if b == 'H':
		print('H')
	else:
		print('D')
elif b == 'H':
	print('D')
else:
	print('H')


print('DH'[input() in 'D DH H'])


f = lambda x: x[0] == x[1]
print('H' if f(list(input().split())) else 'D')


(a, b) = map(str, input().split())
if a == 'H':
	print(b)
elif b == 'H':
	print(a)
else:
	print('H')


val = input().split()
print('H' if val[0] == val[1] else 'D')


(a, b) = input().split()
print('DH'[a == b])


(a, b) = list(map(str, input().split()))
h = 'H'
d = 'D'
result = h
if a == h:
	if b == d:
		result = d
elif b == h:
	result = d
else:
	result = h
print(result)


print('HD'[list(map(str, input().split())).count('H') % 2])


print('HD'[len(set(input())) - 2])


(h, d) = map(str, input().split())
print('H' if h == d else 'D')


(a, b) = input().split()
if a == 'H' and b == 'H':
	result = 'H'
if a == 'D' and b == 'H':
	result = 'D'
if a == 'D' and b == 'D':
	result = 'H'
if a == 'H' and b == 'D':
	result = 'D'
print(result)


(a, _, b) = input()
print('DH'[a == b])


(A, B) = map(str, input().split())
print('H' if A == B else 'D')


s = list(input())
if s[0] == s[2]:
	print('H')
else:
	print('D')


(a, b) = input().split()
if a == 'H' and b == 'H' or (a == 'D' and b == 'D'):
	print('H')
elif a == 'H' and b == 'D' or (a == 'D' and b == 'H'):
	print('D')


l = input().split()
print('H' if l[0] == l[1] else 'D')


S = input().split()
if S[0] == S[1]:
	print('H')
else:
	print('D')


(x, y) = input().split()
print('H' if x == y else 'D')


(a, b) = map(str, input().split())
print(['H', 'D'][a != b])


(a, b) = input().split()
print('HD'[a != b])


say = ''.join(input().split())
if say == 'HH' or say == 'DD':
	print('H')
else:
	print('D')


n = input().split()
if n[0] == n[1]:
	print('H')
else:
	print('D')


(a, _, b) = input()
print(['D', 'H'][a == b])


print('H' if len(set(input().strip().split())) == 1 else 'D')


hint = input()
print('H' if hint[0] == hint[2] else 'D')


(a, b) = map(str, input().split())
if a == 'H' and b == 'H' or (a == 'D' and b == 'D'):
	print('H')
else:
	print('D')


(a, t) = map(str, input().split())
print('H' if a == t else 'D')


s = input()
print('DH'[s[0] == s[2]])


s = input()
print('H' if s == 'H H' or s == 'D D' else 'D')


import sys, math
from itertools import combinations as c, product as p
from collections import deque
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

def si():
	return input()

def ii():
	return int(input())

def fi():
	return float(input())

def lstr():
	return input().split()

def lint():
	return list(map(int, input().split()))

def lint_dec():
	return list(map(lambda x: int(x) - 1, input().split()))

def lnstr(n):
	return [input() for _ in range(n)]

def lnint(n):
	return [int(input()) for _ in range(n)]

def lint_list(n):
	return [lint() for _ in range(n)]
(a, b) = lstr()
print('H' if a == b else 'D')


(h, d) = input().split()
print('H' if h == d else 'D')


a = input().split()
print('H' if a[0] == a[1] else 'D')


print('HD'[len(set(input().split())) - 1])


S = 'HD'
(a, b) = [S.index(c) for c in input().split()]
print(S[(a + b) % 2])


(a, b) = input().split()
d = {'H': 0, 'D': 1}
print(['H', 'D'][d[a] ^ d[b]])


import sys
(a, b) = list(input().split())
print('H' if a == b else 'D')


(A, B) = input().split()
if A == B:
	print('H')
else:
	print('D')


a = input()
print('DH'[a[0] == a[2]])


print('DH'[len(set(input().split())) == 1])


(a, b) = [1 if _ == 'H' else 0 for _ in input().split()]
print('HD'[a ^ b])


(a, _, b) = input()
print('H' if a == b else 'D')


(x, y) = map(lambda x: x == 'D', input().split())
print(['H', 'D'][x ^ y])


(a, _, b) = input().rstrip('\r\n')
print('DH'[a == b])


print('  HD'[len(set(input()))])


A = input().split()
print('H' if A[0] == A[1] else 'D')


x = list(input().split())
if x[0] == x[1]:
	print('H')
else:
	print('D')


(a, b) = input().split()
if a == 'H':
	if b == 'H':
		TopCoDeer = 'H'
	else:
		TopCoDeer = 'D'
elif b == 'H':
	TopCoDeer = 'D'
else:
	TopCoDeer = 'H'
print(TopCoDeer)


x = input().replace(' ', '')
print('H' if x == 'HH' or x == 'DD' else 'D')


tmp = input().split(' ')
print('H') if tmp[0] == tmp[1] else print('D')


(n, _, m) = input()
print('DH'[n == m])


a = input()
print('H' if a == 'H H' or a == 'D D' else 'D')


(a, b) = input().split()
hd = 'HD'
print(hd[(hd.index(a) + hd.index(b)) % 2])


(a, b) = input().split()
print(['HD'.replace(b, ''), b][a == 'H'])


a = input()
print(('D', 'H')[a == 'H H' or a == 'D D'])


(a, b) = map(str, input().split())
print('DH'[a == b::2])


(a, b) = input().split()
print(['HD', 'DH'][a == 'H'][b == 'H'])


(H, D) = input().split()
if H == D:
	print('H')
else:
	print('D')


(at, top) = input().split()
print('H' if at == top else 'D')


(s1, s2) = map(str, input().split())
if s1 == s2:
	print('H')
else:
	print('D')


(a, b) = input().split()
if a == 'H':
	print(b)
elif a == 'D':
	print('HD'[int(not 'HD'.index(b))])


ab = input()
if ab.count('D') == 1:
	print('D')
else:
	print('H')


l = input().split()
print('H' if len(set(l)) == 1 else 'D')


(a, b) = input().split()
print('H' if a + b == 'HH' or a + b == 'DD' else 'D')


print('HD'[input() in 'H D H'])


print(['D', 'H'][len(set(input().split())) == 1])


a = input().split()
if a[0] == 'H' and a[1] == 'H' or (a[0] == 'D' and a[1] == 'D'):
	print('H')
else:
	print('D')


print(['H', 'D'][input().count('H') % 2])


(x, y) = input().split()
print('DH'[x == y])


(a, b) = [c for c in input().split()]
print('H' if a == b else 'D')


(a, b) = map(str, input().split())
if a == b:
	print('H')
elif a != b:
	print('D')


a = input()
print(['H', 'D'][a[0] != a[2]])


print('__HD'[len(set(input()))])


s = input()
print('HD'[(s[0] == 'D') ^ (s[2] == 'D')])


(a, b) = [s for s in input().split()]
print('H') if a == b else print('D')


ab = input()
if ab[0] == ab[2]:
	print('H')
else:
	print('D')


if len(set(input().split())) == 2:
	print('D')
else:
	print('H')


deck = ['H', 'D']
(a, b) = input().split()
if deck.index(a) == 0:
	print(b)
elif deck.index(b) == 0:
	print(deck[1])
else:
	print(deck[0])


a = list(input().split())
if a.count('D') == 1:
	print('D')
else:
	print('H')


(a, b) = map(lambda x: ord(x) - 70, input().split())
print('H' if a * b > 0 else 'D')


S = input().replace('H', '0')
S = S.replace('D', '1')
S_list = list(map(int, S.split()))
if S_list[0] ^ S_list[1] == 0:
	result = 'H'
else:
	result = 'D'
print(result)


import math
(a, b) = input().split()
print('H' if a == b else 'D')


def main():
	(a, b) = input().split()
	print('H' if a == b else 'D')

def __starting_point():
	main()
__starting_point()


print('XXHD'[len(set(input()))])


(a, b) = input().split()
if a == 'H':
	print(b)
else:
	print('HD'[b == 'H'])


(a, _, b) = input()
if a == 'H' and b == 'H':
	print('H')
elif a == 'H' and b == 'D':
	print('D')
elif a == 'D' and b == 'H':
	print('D')
else:
	print('H')


ab = input()
print('H' if ab == 'H H' or ab == 'D D' else 'D')


ab = set(input().split())
ans = 'H' if len(ab) == 1 else 'D'
print(ans)


s = {'H': 0, 'D': 1}
t = 0
a = input().split()
for i in range(2):
	t += s[a[i]]
if t % 2 != 0:
	print('D')
else:
	print('H')


(a, b) = input().split()
x = a == 'H'
y = b == 'H'
if x ^ y:
	print('D')
else:
	print('H')


a = input()
print('HD'[a[0] != a[2]])


num = input().split()
if num[0] == num[1]:
	print('H')
else:
	print('D')


i = input()
print(['D', 'H'][i[-1] == 'D'] if i[0] == 'D' else i[-1])


print(['D', 'H'][''.join(input().split()) in ['HH', 'DD']])


(ina, inb) = input().split()
if ina == inb:
	print('H')
else:
	print('D')


(input_a, input_b) = list(map(str, input().split()))
reslut = 'ret'
if input_a == 'H':
	if input_b == 'H':
		result = 'H'
	elif input_b == 'D':
		result = 'D'
elif input_a == 'D':
	if input_b == 'H':
		result = 'D'
	elif input_b == 'D':
		result = 'H'
else:
	reslut = "I don't Know."
print(result)


(a, b) = map(str, input().split())
if a == 'H':
	a = 1
else:
	a = 0
if b == 'H':
	b = 1
else:
	b = 0
if a ^ b == 0:
	print('H')
else:
	print('D')


str = input().split()
print('H' if str[0] == str[1] else 'D')


s = input()
print('DH'[s == s[::-1]])


(d, _, h) = input()
print('H' if d == h else 'D')


t = input()
if t == 'H H' or t == 'D D':
	print('H')
else:
	print('D')


(a, _, b) = input()
print('HD'[a != b])


s = input()
print(['D', 'H'][s[0] == s[2]])