Problem:

Finding Missing Cards

  Taro is going to play a card game. However, now he has only n cards, even though there should be 52 cards (he has no Jokers).

The 52 cards include 13 ranks of each of the four suits: spade, heart, club and diamond.

Input

  In the first line, the number of cards n (n ≤ 52) is given.

  In the following n lines, data of the n cards are given. Each card is given by a pair of a character and an integer which represent its suit and rank respectively. A suit is represented by 'S', 'H', 'C' and 'D' for spades, hearts, clubs and diamonds respectively. A rank is represented by an integer from 1 to 13.

Output

  Print the missing cards. The same as the input format, each card should be printed with a character and an integer separated by a space character in a line.
 Arrange the missing cards in the following priorities:

Print cards of spades, hearts, clubs and diamonds in this order.

If the suits are equal, print cards with lower ranks first.

Sample Input

47
S 10
S 11
S 12
S 13
H 1
H 2
S 6
S 7
S 8
S 9
H 6
H 8
H 9
H 10
H 11
H 4
H 5
S 2
S 3
S 4
S 5
H 12
H 13
C 1
C 2
D 1
D 2
D 3
D 4
D 5
D 6
D 7
C 3
C 4
C 5
C 6
C 7
C 8
C 9
C 10
C 11
C 13
D 9
D 10
D 11
D 12
D 13

Sample Output

S 1
H 3
H 7
C 12
D 8

Note

      解説      

	



Sample input:
47
S 10
S 11
S 12
S 13
H 1
H 2
S 6
S 7
S 8
S 9
H 6
H 8
H 9
H 10
H 11
H 4
H 5
S 2
S 3
S 4
S 5
H 12
H 13
C 1
C 2
D 1
D 2
D 3
D 4
D 5
D 6
D 7
C 3
C 4
C 5
C 6
C 7
C 8
C 9
C 10
C 11
C 13
D 9
D 10
D 11
D 12
D 13


Sample output:
S 1
H 3
H 7
C 12
D 8

Submission status: Accepted

Solution code:
card ={'S': [0]*13,
       'H': [0]*13,
       'C': [0]*13,
       'D': [0]*13
}

n = int(input())

for i in range(1,n+1):
    m,num = input().split()
    num = int(num)
    card[m][num-1] =1

for c in ["S","H","C","D"]:
    for j in range(1,14):
        if (card[c][j-1]==0):
            print(c,str(j))

Submission status: Accepted

Solution code:
n = int(input())

remind = []
for i in range(n):
   remind.append(input())

egara = ["S ", "H ", "C ", "D "]
for i in range(4):
   for j in range(1, 14):
      if egara[i] + str(j) not in remind:
         print(egara[i] + str(j))

Submission status: Accepted

Solution code:
c=[f'{s} {i}'for s in'SHCD'for i in range(1,14)]
for _ in[0]*int(input()):c.remove(input())
for x in c:print(x)

Submission status: Accepted

Solution code:
n=int(input())
e=[input()for _ in[0]*n]
for s in"SHCD":
 for r in range(1,14):
  if f'{s} {r}'not in e:print(s,r)

Submission status: Accepted

Solution code:
S = [0,0,0,0,0,0,0,0,0,0,0,0,0,0]
H = [0,0,0,0,0,0,0,0,0,0,0,0,0,0]
C = [0,0,0,0,0,0,0,0,0,0,0,0,0,0]
D = [0,0,0,0,0,0,0,0,0,0,0,0,0,0]
l=int(input())
for i in range(l):
	a,b = input().split()
	b = int(b) 
	if   a == 'S':
			S[b] = 1
	elif a == 'H' :
			H[b] = 1
	elif a == 'C':
			C[b] = 1
	elif a == 'D':
			D[b] = 1
for k in range(1,14):
	if not S[k] :
		print('S',k)
for k in range(1,14):
	if not H[k] :
		print('H',k)
for k in range(1,14):
	if not C[k] :
		print('C',k)
for k in range(1,14):
	if not D[k] :
		print('D',k)

Submission status: Accepted

Solution code:
used = [[False for i in range(13)] for i in range(4)]
mark = "SHCD"
dic = {"S": 0, "H": 1, "C": 2, "D": 3}

n = int(input())
for i in range(n):
    li = input().split()
    m = li[0]
    k = int(li[1])

    used[dic[m]][k - 1] = True

for i in range(4):
    for j in range(13):
        if (not used[i][j]):
            print("{0} {1}".format(mark[i], j+1))

Submission status: Accepted

Solution code:
n=int(input())
s=[1,2,3,4,5,6,7,8,9,10,11,12,13]
h=[1,2,3,4,5,6,7,8,9,10,11,12,13]
c=[1,2,3,4,5,6,7,8,9,10,11,12,13]
d=[1,2,3,4,5,6,7,8,9,10,11,12,13]

while n>0:
    l=input().split()
    if l[0]=="S":
        s.remove(int(l[1]))
    elif l[0]=="H":
        h.remove(int(l[1]))
    elif l[0]=="C":
        c.remove(int(l[1]))
    else:
        d.remove(int(l[1]))
    n=n-1

if not s==[]:
    for a in s:
        print("S "+str(a))
else:
    pass

if not h==[]:
    for b in h:
        print("H "+str(b))
else:
    pass

if not c==[]:
    for e in c:
        print("C "+str(e))
else:
    pass

if not d==[]:
    for f in d:
        print("D "+str(f))
else:
    pass

Submission status: Accepted

Solution code:
n = int(input())
trump_list = [[0 for i in range(13)] for j in range(4)]
for cardnum in range(n):
    x = [i for i in input().split()]
    x[1] = int(x[1])
    if x[0] == 'S':
        trump_list[0][x[1] - 1] = 1
    elif x[0] == 'H':
        trump_list[1][x[1] - 1] = 1
    elif x[0] == 'C':
        trump_list[2][x[1] - 1] = 1
    elif x[0] == 'D':
        trump_list[3][x[1] - 1] = 1

for art in range(4):
    if art == 0:
        art_kind = 'S'
    elif art == 1:
        art_kind = 'H'
    elif art == 2:
        art_kind = 'C'
    elif art == 3:
        art_kind = 'D'
    for number in range(13):
        if trump_list[art][number] == 0:
            print(art_kind,number+1)

Submission status: Accepted

Solution code:
n=int(input())
x={0:'S',1:'H',2:'C',3:'D'}
c=[[0]*13,[0]*13,[0]*13,[0]*13]
for r in range(n):
    a,b=input().split()
    b=int(b)-1
    if a=='S':
        c[0][b]=1
    elif a=='H':
        c[1][b]=1
    elif a=='C':
        c[2][b]=1
    else:
        c[3][b]=1
for i in range(4):
    for j in range(13):
        if c[i][j]==0:
            print(x[i],j+1)

Submission status: Accepted

Solution code:
import sys
i = 0
x = []
for line in sys.stdin:
    if i==0:
        x.append(int(line))
    else:
        s1 = 'SHCD'.index(line[0])
        s2 = int(line[2:])
        x.append((s1,s2))
    i = 1
 
r4 = range(4)
r13 = range(13)
lx = x.pop(0)
cards = [[0 for i in r13] for j in r4]
for j,i in x: cards[j][i-1] = 1
 
for j in r4:
    for i in r13:
        if cards[j][i]==0: print 'SHCD'[j],str(i+1)

Submission status: Accepted

Solution code:
c={
    'S':[1]*13,
    'H':[1]*13,
    'C':[1]*13,
    'D':[1]*13
}
n=int(input())
for i in range(n):
    a,b=input().split()
    c[a][int(b)-1]=0
for i in ['S','H','C','D']:
    for j in range(13):
        if c[i][j]==1:
            print(i,j+1)

Submission status: Accepted

Solution code:
# 正解データ
tramps = {
    "S": [0] * 13,
    "H": [0] * 13,
    "C": [0] * 13,
    "D": [0] * 13
}
# print(tramps)

# 持っているカード
n = int(input())

for i in range(n):
    kind, num = input().split()
    tramps[kind][int(num) - 1] = 1

for i in ["S", "H", "C", "D"]:
    for j in range(13):
        tramp = tramps[i][j]
        if tramp == 0:
            print("{} {}".format(i, j+1))

Submission status: Accepted

Solution code:
def tonum(suit):
    if suit == 'S': return 0
    if suit == 'H': return 1
    if suit == 'C': return 2
    if suit == 'D': return 3
    
def tosuit(num):
    suits = ['S', 'H', 'C', 'D']
    return suits[num]
    
def main():
    n = int(input())
    cards = [i for i in range(52)]
    for i in range(n):
        a = input().split()
        cards.remove(tonum(a[0]) * 13 + int(a[1]) - 1)
    cards.sort()
    for i in cards:
        print(tosuit(i // 13) + " " + str(i % 13 + 1))
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import sys

SUITS = ('S', 'H', 'C', 'D')
cards = {suit:{i for i in range(1, 14)} for suit in SUITS}

n = input() # solo leer

for line in sys.stdin:
    suit, number = line.split()
    cards[suit].discard(int(number))

for suit in SUITS:
    for i in cards[suit]:
        print(suit, i)

Submission status: Accepted

Solution code:
card_exists = {
    "S" : [False for _ in range(13)],
    "H" : [False for _ in range(13)],
    "C" : [False for _ in range(13)],
    "D" : [False for _ in range(13)]
}

card_count = int(input())
for i in range(card_count):
    suit, num = input().split()
    card_exists[suit][int(num) - 1] = True

for suit in card_exists.keys():
    for idx, exists in enumerate(card_exists[suit]):
        if not exists:
            print(suit, str(idx + 1))

Submission status: Accepted

Solution code:
N = int(input())
n = [input().split() for _ in range(N)]

all_card = {"S": [], "H": [], "C": [], "D": []}
number = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

for k in n:
    all_card[k[0]].append(int(k[1]))

for c in ["S", "H", "C", "D"]:
    res = list(set(number) - set(all_card[c]))
    res.sort()
    for n in list(res):
        print("{} {}".format(c, n))

Submission status: Accepted

Solution code:
import sys

SUITS = ('S', 'H', 'C', 'D')
cards = {suit:{i for i in range(1, 14)} for suit in SUITS}

input()

for line in sys.stdin:
    suit, number = line.split()
    cards[suit].discard(int(number))

for suit in SUITS:
    for i in cards[suit]:
        print(suit, i)

Submission status: Accepted

Solution code:
def find_card():
    n = int(input())
    sute = ['S', 'H', 'C', 'D']
    cards = []
    for s in sute:
        for i in range(1, 14):
            cards.append('{} {}'.format(s,i))
    for i in range(n):
        x,y = input().split()
        l = ' '.join([x,y])
        if l in cards:
            cards.remove(l)
    for i in cards:
        print(i)
        
if __name__ == '__main__':
    find_card()

Submission status: Accepted

Solution code:
def cls(m):
    if m == 'S':
        S.append(num)
    elif m == 'H':
        H.append(num)
    elif m == 'C':
        C.append(num)
    else:
        D.append(num)


def extract(m):
    for i in range(1, 14):
        if i not in eval(m):
            print(m, i)


n = int(input())
S, H, C, D = [], [], [], []
for i in range(n):
    m, num = input().split()
    num = int(num)
    cls(m)

S, H, C, D = sorted(S), sorted(H), sorted(C), sorted(D)
for m in 'SHCD':
    extract(m)

Submission status: Accepted

Solution code:
n = int(input())
a = [] #手持ちのカード
for i in range(n):
    x, y = input().split()
    a.append([x, y])

trump = [] #トランプ全体
for i in range(1,14):
    trump.append(['S', str(i)])
    trump.append(['H', str(i)])
    trump.append(['C', str(i)])
    trump.append(['D', str(i)])

#手持ちを引く #ここがわからん
dif = []
for i in range(1,14):
    dif.append(['S', str(i)])
    dif.append(['H', str(i)])
    dif.append(['C', str(i)])
    dif.append(['D', str(i)])
for i in range(len(trump)):
    for j in range(len(a)):
        if trump[i] == a[j]:
            dif.remove(trump[i])

for i in range(len(dif)):
    x = dif[i]
    if x[0] == "S":
        print(x[0] +' '+ x[1])
for i in range(len(dif)):
    x = dif[i]
    if x[0] == "H":
        print(x[0] + ' '+ x[1])
for i in range(len(dif)):
    x = dif[i]
    if x[0] == "C":
        print(x[0] + ' '+ x[1])
for i in range(len(dif)):
    x = dif[i]
    if x[0] == "D":
        print(x[0] + ' '+ x[1])

Submission status: Accepted

Solution code:
N=int(input())
a = []
for line in range(N):
    input1,input2=input().split()
    a.append(input1+str(input2))

b = ['S','H','C','D']
cards = []
for i in b:
    for j in range(1,14):
        c =i + str(j)
        cards.append(c)

for i in a:
    cards.remove(i)

for i in cards:

    out = i[0:1] + " " + i[1::]
    print(out)

Submission status: Accepted

Solution code:
c={
    'S':[0]*13,
    'H':[0]*13,
    'C':[0]*13,
    'D':[0]*13
}
n=int(input())
for i in range(n):
    s,num=input().split()
    c[s][int(num)-1]=1
for i in["S","H","C","D"]:
    for j in range(13):
        if c[i][j]==0:
            print(i,j+1)

Submission status: Accepted

Solution code:

3
4
5
6
7
8
9
10
11
12
13
14
15
16
# -*- coding: utf-8 -*-
'import sys'
c={
    'S':[0]*13,
    'H':[0]*13,
    'C':[0]*13,
    'D':[0]*13
}
n=int(input())
for i in range(n):
    s,num=input().split()
    c[s][int(num)-1]=1
for i in["S","H","C","D"]:
    for j in range(13):
        if c[i][j]==0:
            print(i,j+1)

Submission status: Accepted

Solution code:
n=input()
s=[[1 for i in range(13)] for j in range(4)]
for i in range(n):
  a,b=map(str,raw_input().split())
  b=int(b)
  if a=='S':s[0][b-1]=0
  elif a=='H':s[1][b-1]=0
  elif a=='C':s[2][b-1]=0
  else:s[3][b-1]=0
for i in range(4):
  for j in range(13):
    if s[i][j]:
      if i==0:print'S',j+1
      if i==1:print'H',j+1
      if i==2:print'C',j+1
      if i==3:print'D',j+1

Submission status: Accepted

Solution code:
n = int(input())
S, H, C, D = [], [], [], []

for i in range(n):
    p, num = input().split()
    eval(p).append(int(num))

for i in "SHCD":
    for j in range(1, 14):
        if j not in eval(i):
            print(i, j)

Submission status: Accepted

Solution code:
CARD_NUM = 13
spades = [0] * CARD_NUM
hearts = [0] * CARD_NUM
clubs = [0] * CARD_NUM
diamonds = [0] * CARD_NUM

n = int(input())
for i in range(n):
	pair = list(map(str, input().split()))
	suit = pair[0]
	rank = int(pair[1])
	if suit == 'S': spades[rank - 1] = 1
	if suit == 'H': hearts[rank - 1] = 1
	if suit == 'C': clubs[rank - 1] = 1
	if suit == 'D': diamonds[rank - 1] = 1

for i in range(CARD_NUM):
	if spades[i] == 0: print('S ' + str(i + 1))
for i in range(CARD_NUM):
	if hearts[i] == 0: print('H ' + str(i + 1))
for i in range(CARD_NUM):
	if clubs[i] == 0: print('C ' + str(i + 1))
for i in range(CARD_NUM):
	if diamonds[i] == 0: print('D ' + str(i + 1))

Submission status: Accepted

Solution code:
CARD_NUM = 13
cards = [[0 for x in range(CARD_NUM)] for y in range(4)] 

n = int(input())
for i in range(n):
	pair = list(map(str, input().split()))
	suit = pair[0]
	rank = int(pair[1])
	if suit == 'S': cards[0][rank - 1] = 1
	if suit == 'H': cards[1][rank - 1] = 1
	if suit == 'C': cards[2][rank - 1] = 1
	if suit == 'D': cards[3][rank - 1] = 1

for i in range(CARD_NUM):
	if cards[0][i] == 0: print('S ' + str(i + 1))
for i in range(CARD_NUM):
	if cards[1][i] == 0: print('H ' + str(i + 1))
for i in range(CARD_NUM):
	if cards[2][i] == 0: print('C ' + str(i + 1))
for i in range(CARD_NUM):
	if cards[3][i] == 0: print('D ' + str(i + 1))

Submission status: Accepted

Solution code:
n = int(input())
card = {
    'S':[False for _ in range(13)],
    'H':[False for _ in range(13)],
    'C':[False for _ in range(13)],
    'D':[False for _ in range(13)]
}
for _ in range(n):
    mark, num = input().split()
    num = int(num)
    card[mark][num-1] = True

for mark in "SHCD":
    for num in range(13):
        if card[mark][num] is False:
            print(mark, num+1)

Submission status: Accepted

Solution code:
a = []
b = ("S", "H", "C", "D")
n = int(input())
for y in b:
    for x in range(1,14):
        a.append(y+" "+str(x))
for y in range(n):
    z = input()
    a.remove(z)
for rem in a:
    print(rem)

Submission status: Accepted

Solution code:

# -*- coding: utf-8

n = int(input())
bs = []
bh = []
bc = []
bd = []

for i in range(n):    
    a = input().split()
    if a[0] == 'S':
        bs.append(int(a[1]))  
    if a[0] == 'H':
        bh.append(int(a[1]))  
    if a[0] == 'C':
        bc.append(int(a[1]))  
    if a[0] == 'D':
        bd.append(int(a[1]))

for ks in range(1,14):
    if ks not in bs:
        print('S '+str(ks))

for kh in range(1,14):
    if kh not in bh:
        print('H '+str(kh))
        
for kc in range(1,14):
    if kc not in bc:
        print('C '+str(kc))
        
for kd in range(1,14):
    if kd not in bd:
        print('D '+str(kd))

Submission status: Accepted

Solution code:
n=int(input())
S=[0,0,0,0,0,0,0,0,0,0,0,0,0,0]
H=[0,0,0,0,0,0,0,0,0,0,0,0,0,0]
C=[0,0,0,0,0,0,0,0,0,0,0,0,0,0]
D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0]
for i in range(n):
    k=input().split()
    j=int(k[1])
    if k[0]=="S":
        S[j]=1
    if k[0]=="H":
        H[j]=1
    if k[0]=="C":
        C[j]=1
    if k[0]=="D":
        D[j]=1
for i in range(1,14):
    if S[i]==0:
        print("S "+str(i))
for i in range(1,14):
    if H[i]==0:
        print("H "+str(i))
for i in range(1,14):
    if C[i]==0:
        print("C "+str(i))
for i in range(1,14):
    if D[i]==0:
        print("D "+str(i))

Submission status: Accepted

Solution code:
n=int(input())
card=list()
for i in range(4):
    mark=[0]*13
    card.append(mark)
for i in range(n):
    pattern,number=map(str,input().split())
    if pattern=='S':
        card[0][int(number)-1]=1
    elif pattern=='H':
        card[1][int(number)-1]=1
    elif pattern=='C':
        card[2][int(number)-1]=1
    else:
        card[3][int(number)-1]=1
for i in range(4):
    for j in range(13):
        if card[i][j]!=1:
            if i==0:
                print("S",j+1)
            elif i==1:
                print("H",j+1)
            elif i==2:
                print("C",j+1)
            else:
                print("D",j+1)

Submission status: Accepted

Solution code:

import sys

c = int(input())

a = []
for line in sys.stdin :
    a.append(line)
    c -= 1
    if c == 0 :
        break

for i in range(0, len(a)) :
    a[i] = a[i].strip().split(" ")
    a[i][1] = int(a[i][1])

for i in ["S", "H", "C", "D"] :
    for j in range(1, 13+1) :
        if a.count([i, j]) == 0 :
            print(str(i) + " " + str(j))

Submission status: Accepted

Solution code:
# Finding Missing Cards

n = int(input())

exist = []
for i in range(4):
    exist.append([0 for j in range(13)])

for i in range(n):
    cards = [a for a in input().rstrip().split()]
    p = cards[0]
    k = int(cards[1]) - 1
    if p == 'S':
        exist[0][k] = 1
    elif p == 'H':
        exist[1][k] = 1
    elif p == 'C':
        exist[2][k] = 1
    elif p == 'D':
        exist[3][k] = 1

# print()

figure = ['S', 'H', 'C', 'D']
# print('足りないカードは')
for i in range(4):
    for j in range(13):
        if exist[i][j] == 0:
            print(figure[i] + ' ' + str(j + 1))

Submission status: Accepted

Solution code:
#'S', 'H', 'C', 'D'  1~13
n = int(input())
Slist = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Hlist = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Clist = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Dlist = [1,2,3,4,5,6,7,8,9,10,11,12,13]

card_list = []
for i in range(n):
    s,num = input().split()
    one_card = [str(s),int(num)]
    card_list.append(one_card)
    if(str(s) == 'S'):
        Slist.remove(int(num))
        #print(Slist)
    elif(str(s) == 'H'):
        Hlist.remove(int(num))
    elif(str(s) == 'C'):
        Clist.remove(int(num))
    elif(str(s) == 'D'):
        Dlist.remove(int(num))
while len(Slist) :
    for s in Slist:
        print('S {}'.format(s))
    break
while len(Hlist) :
    for s in Hlist:
        print('H {}'.format(s))
    break
while len(Clist) :
    for s in Clist:
        print('C {}'.format(s))
    break
while len(Dlist) :
    for s in Dlist:
        print('D {}'.format(s))
    break

Submission status: Accepted

Solution code:
n=int(input())
S="SHCD"
A=[]
for i in range(4):
    B=[0 for i in range(13)]
    A.append(B)
for i in range(n):
    a,b=[j for j in input().split()]
    b=int(b)
    b-=1
    if a=="S":
        a=0
    elif a=="H":
        a=1
    elif a=="C":
        a=2
    else: 
        a=3
    A[a][b]=1
for i in range(4):
    for j in range(13):
        if A[i][j]==0:
            print(S[i],end=" ")
            print(j+1)

Submission status: Accepted

Solution code:
c = {
    "S":[0]*13,
    "H":[0]*13,
    "C":[0]*13,
    "D":[0]*13,
    }
n = int(input())
for i in range(n):
	s, num = input().split()
	c[s][int(num)-1]=1
for i in ["S", "H", "C", "D"]:
	for j in range (13):
		if c[i][j] ==0:
			print(i, j+1)

Submission status: Accepted

Solution code:
def main():

    numlist = set()
    x = int(input())

    for _ in range(x):
        numlist.add(tuple(input().split()))
    
    cards = set()
    for mark in ('S', 'H', 'C', 'D'):
        for i in range(1,14):
            cards.add((mark, str(i)))

    for item in numlist:
        cards.remove(item)

    for mark in ('S', 'H', 'C', 'D'):
        for i in range(1, 14):
            if (mark, str(i)) in cards:
                print(mark, i)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
marks = ["S", "H", "C", "D"]
cards = {}

n = int(input())

for _ in range(0, n):
    mark, num = input().split()

    if mark not in cards:
        cards[mark] = []

    cards[mark].append(int(num))

for mark in marks:
    for n in range(1, 14):
        if n in cards[mark]:
            continue

        print("{} {}".format(mark, n))

Submission status: Accepted

Solution code:
n = int(input())
d = {"S":[None]*13, "H":[None]*13, "C":[None]*13, "D":[None]*13}

for i in range(n):
    x, y = raw_input().split()
    d[x][int(y)-1] = True

for k in ["S", "H", "C", "D"]:
    for i in range(13):
        if d[k][i]:
            continue
        print("%s %d" % (k, i+1))

Submission status: Accepted

Solution code:
import sys
i = 0
x = []
for line in sys.stdin:
    if i==0:
        x.append(int(line))
    else:
        s1 = 'SHCD'.index(line[0])
        s2 = int(line[2:])
        x.append((s1,s2))
    i = 1

r4 = range(4)
r13 = range(13)
lx = x.pop(0)
cards = [[0 for i in r13] for j in r4]
for j,i in x: cards[j][i-1] = 1

for j in r4:
    for i in r13:
        if cards[j][i]==0: print 'SHCD'[j],str(i+1)

Submission status: Accepted

Solution code:
r4 = range(4)
r13 = range(13)
cards = [[0 for i in r13] for j in r4]

n = input()
for i in range(n):
    s1, s2 = raw_input().split()
    s1 = 'SHCD'.index(s1)
    s2 = int(s2)-1
    cards[s1][s2] = 1

for j in r4:
    for i in r13:
        if cards[j][i]==0:
            print 'SHCD'[j],i+1

Submission status: Accepted

Solution code:
n=int(raw_input())
cards=[[0 for j in range(13)]for i in range(4)]
for i in range(n):
        c=map(str,raw_input().split())
        if c[0]=="S":
                c[0]=0
        elif c[0]=="H":
                c[0]=1
        elif c[0]=="C":
                c[0]=2
        elif c[0]=="D":
                c[0]=3
        cards[int(c[0])][int(c[1])-1]=1
for i in range(4):
        for j in range(13):
                if cards[i][j] == 0:
                        if i == 0:
                                k=str("S")
                        elif i == 1:
                                k=str("H")
                        elif i == 2:
                                k=str("C")
                        elif i == 3:
                                k=str("D")
                        print k,j+1

Submission status: Accepted

Solution code:
from __future__ import division, print_function
from sys import stdin
cards = [True] * 52
suits = {'S': 13*0, 'H': 13*1, 'C': 13*2, 'D': 13*3}
for _ in range(int(stdin.readline())):
    s, i = stdin.readline().split()
    cards[suits[s] + int(i) - 1] = False
for i, f, in enumerate(cards):
    if f:
        print('SHCD'[i//13], i % 13 + 1)

Submission status: Accepted

Solution code:
import sys

cards_exist = []
for lineCnt, line in enumerate(sys.stdin):
    if lineCnt == 0: continue
    cards_exist.append(line.rstrip('\n'))

for suit in ('S', 'H', 'C', 'D'):
    for num in range(1, 14):
        card = '%s %d' % (suit, num) 
        if card in cards_exist: continue
        print card

Submission status: Accepted

Solution code:
#!/usr/bin/python
# coding: utf-8
import sys

n=int(raw_input())
m=n
w,S,H,C,D=[],[],[],[],[]
CARD=['1','2','3','4','5','6','7','8','9','10','11','12','13']
for i in xrange(n):
    w.append(map(str, raw_input().split()))

for j in xrange(m):
    if str(w[j][0]) == 'S': S.append(str(w[j][1]))
    elif str(w[j][0]) == 'H': H.append(str(w[j][1]))
    elif str(w[j][0]) == 'C': C.append(str(w[j][1]))
    else: D.append(str(w[j][1]))

for a in range(0,13):
    if CARD[a] not in S: print 'S',str(a+1)
for b in range(0,13):
    if CARD[b] not in H: print 'H',str(b+1)
for c in range(0,13):
    if CARD[c] not in C: print 'C',str(c+1)
for d in range(0,13):
    if CARD[d] not in D: print 'D',str(d+1)

Submission status: Accepted

Solution code:
cards = [[0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0,0,0,0,0,0]]
suit_dic = {'S':0, 'H':1, 'C':2, 'D':3}
suits_list = ['S', 'H', 'C', 'D']
n = input()
while (n>0):
	n -= 1
	suit, number = raw_input().split()
	cards[suit_dic.get(suit)][int(number) - 1] = 1
for i in range(0, 4):
	for j in range(0, 13):
		if cards[i][j] == 0:
			print suits_list[i], j+1

Submission status: Accepted

Solution code:
n = int(raw_input())
a = []
for i in ["S","H","C","D"]:
    for j in xrange(1,14):
        a.append("{0} {1}".format(i,j))
for i in xrange(0,n):
    b = raw_input()
    a.remove(b)
for i in a:
    print i

Submission status: Accepted

Solution code:
n = int(raw_input())
a = []
for i in ["S","H","C","D"]:
    for j in xrange(1,14):
        a.append("{0} {1}".format(i,j))
for i in xrange(0,n):
    a.remove(raw_input())
for i in a:
    print i

Submission status: Accepted

Solution code:
n = input()
x = {'S':[], 'H':[], 'C':[], 'D':[]}
for i in range(n):
    a = raw_input().split()
    x[a[0]].append(int(a[1]))
for key in ['S', 'H', 'C', 'D']:
    for i in range(13):
        for j in x[key]:
            if i+1 == j: break
        else: print key, i+1

Submission status: Accepted

Solution code:
Sp = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Hu = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Cr = [1,2,3,4,5,6,7,8,9,10,11,12,13]
Dy = [1,2,3,4,5,6,7,8,9,10,11,12,13]

num = int(input())
i = 0

while i < num:
     suit, n = raw_input().split()
     n = int(n)
     if suit == "S":
        Sp[n-1] = 0
     elif suit == "H":
        Hu[n-1] = 0
     elif suit == "C":
        Cr[n-1] = 0
     else:
        Dy[n-1] = 0
     i += 1

for i in Sp:
    if i != 0:
        print "S", i

for i in Hu:
    if i != 0:
        print "H", i

for i in Cr:
    if i != 0:
        print "C", i

for i in Dy:
    if i != 0:
        print "D", i

Submission status: Accepted

Solution code:
n = input()
mark = ['S', 'H', 'C', 'D']
cards = ["{} {}".format(mark[i], j+1) for i in range(4) for j in range(13)]
for i in range(n):
	cards.remove(raw_input())
while len(cards) != 0:
	print cards.pop(0)

Submission status: Accepted

Solution code:
a = [
[0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0],
]

b = {"S":0,"H":1,"C":2,"D":3}
c = ["S","H","C","D"]
n = input()
    
while n > 0:
    x,y = raw_input().split()
    a[b.get(x)][int(y)-1] = 1
    n -= 1

for i in range(4):
    for j in range(13):
        if a[i][j] == 0:
            print c[i],j + 1

Submission status: Accepted

Solution code:
n = int(input())
cards = []
for i in range(n):
    s, r = input().strip().split()
    cards.append((s, int(r)))
for s, r in [(s, r) for s in 'SHCD' for r in range(1, 14) if (s, r) not in cards]:
    print(s, r)

Submission status: Accepted

Solution code:
cards = [[False for i in range(13)] for j in range(4)]
pattern = ["S","H","C","D"]
n = int(input())
for i in range(n):
    line = input().split()
    ch = line[0]
    num = int(line[1])
    cards[pattern.index(ch)][num-1] = True
for j in range(4):
    for i in range(13):
        if cards[j][i] == False:
            print(pattern[j],i+1)

Submission status: Accepted

Solution code:
N=int(input())
card=[[0 for i in range(14)] for i in range(4)]
for i in range(N):
    kind,num=map(str,input().split())
    num=int(num)
    if kind=="S":
        card[0][num]+=1
    elif kind=="H":
        card[1][num]+=1
    elif kind=="C":
        card[2][num]+=1
    elif kind=="D":
        card[3][num]+=1

for j in range(4):
    for t in range(1,14):
        if card[j][t]==0:
            if j==0:
                print("S {}".format(t))
            elif j==1:
                print("H {}".format(t))
            elif j==2:
                print("C {}".format(t))
            elif j==3:
                print("D {}".format(t))

Submission status: Accepted

Solution code:
N=int(input())
S=[1,2,3,4,5,6,7,8,9,10,11,12,13]
H=[1,2,3,4,5,6,7,8,9,10,11,12,13]
C=[1,2,3,4,5,6,7,8,9,10,11,12,13]
D=[1,2,3,4,5,6,7,8,9,10,11,12,13]
for i in range(N):
    L=list(map(str,input().split()))
    
    if L[0]=="S":
        S.remove(int(L[1]))
    elif L[0]=="H":
        H.remove(int(L[1]))
    elif L[0]=="C":
        C.remove(int(L[1]))
    else:
        D.remove(int(L[1]))
for i in S:
    print("S",i)
for j in H:
    print("H",j)
for k in C:
    print("C",k)
for z in D:
    print("D",z)

Submission status: Accepted

Solution code:
n=int(input())
s=[]
h=[]
c=[]
d=[]

for i in range(n):
    a,b=map(str,input().split())
    if a=="S":
        s.append(int(b))
    if a=="H":
        h.append(int(b))
    if a=="C":
        c.append(int(b))
    if a=="D":
        d.append(int(b))
for i in range(1,14):
    if i in s:
        pass
    else:
        print("S",i)
for i in range(1,14):
    if i in h:
        pass
    else:
        print("H",i)
for i in range(1,14):
    if i in c:
        pass
    else:
        print("C",i)
for i in range(1,14):
    if i in d:
        pass
    else:
        print("D",i)

Submission status: Accepted

Solution code:
n = int(input())

S = [i for i in range(1, 14)]
H = [i for i in range(1, 14)]
C = [i for i in range(1, 14)]
D = [i for i in range(1, 14)]

for i in range(n) :
    a,b= map(str, input().split())
    
    if a== "S" :
        S.remove(int(b))
    elif a == "H" :
        H.remove(int(b))
    elif a == "C" :
        C.remove(int(b))
    else :
        D.remove(int(b))
        
if len(S) > 0 :
    for i in range(len(S)) :
        print("S", S[i])
if len(H) > 0 :
    for i in range(len(H)) :
        print("H", H[i])
if len(C) > 0 :
    for i in range(len(C)) :
        print("C", C[i])
if len(D) > 0 :
    for i in range(len(D)) :
        print("D", D[i])

Submission status: Accepted

Solution code:
n=int(input())
s=[0]*13
h=[0]*13
c=[0]*13
d=[0]*13
for i in range(n):
    a,b=map(str,input().split())
    if a=='S':
        s[int(b)-1]=1
    elif a=='H':
        h[int(b)-1]=1
    elif a=='C':
        c[int(b)-1]=1
    else:
        d[int(b)-1]=1

for i in range(13):
    if s[i]==0:
        print('S',i+1)
for i in range(13):
    if h[i]==0:
        print('H',i+1)
for i in range(13):
    if c[i]==0:
        print('C',i+1)
for i in range(13):
    if d[i]==0:
        print('D',i+1)

Submission status: Accepted

Solution code:
maisu = int(input())
arucard = []
suto = ["S","H","C","D"]
kazu = ["1","2","3","4","5","6","7","8","9","10","11","12","13"]
trump = []
for a in suto:
    for b in kazu:
        card = (a+" "+b)
        trump.append(card)
#print(trump)
for n in range(maisu):
    nakusi = input()
    arucard.append(nakusi)
for x in arucard:
    trump.remove(x)
for y in trump:
    print(y)

Submission status: Accepted

Solution code:
N=int(input())
suits=["S","H","C","D"]
cards=[]
for _ in range(N):
    s,n=input().split()
    if s=="S":
        cards.append(int(n))
    elif s=="H":
        cards.append(13+int(n))
    elif s=="C":
        cards.append(26+int(n))
    else:
        cards.append(39+int(n))
        
for i in range(1,53):
    if i not in cards:
        print(suits[(i-1)//13],(i-1)%13+1)

Submission status: Accepted

Solution code:
card = list()
suit = ['S', 'H', 'C', 'D']
n = int(input())
for i in range(n):
    s, c = input().split()
    c = int(c)
    if s == "S":
        card.append(0+c)
    elif s == "H":
        card.append(13+c)
    elif s == "C":
        card.append(26+c)
    else:
        card.append(39+c)
for i in range(1,53):
    if not (i in card):
        print(suit[(i-1)//13],(i-1)%13+1)

Submission status: Accepted

Solution code:
N=int(input())
suits=["S","H","C","D"]
cards=[]
for _ in range(N):
	s,n=input().split()
	if s=="S":
		cards.append(int(n))
	elif s=="H":
		cards.append(13+int(n))
	elif s=="C":
		cards.append(26+int(n))
	else:
		cards.append(39+int(n))
for i in range(1,53):
	if i not in cards:
		print(suits[(i-1)//13],(i-1)%13+1)

Submission status: Accepted

Solution code:
n=int(input())
card=[[False for i in range(13)] for j in range(4)]

for i in range(n):
    mark,suit=input().split()
    if mark=='S':
        mark_num=0
    elif mark=='H':
        mark_num=1
    elif mark=='C':
        mark_num=2
    elif mark=='D':
        mark_num=3
    card[mark_num][int(suit)-1]=True

for j in range(4):
    for i in range(13):
        if card[j][i]==False:
            if j==0:
                print('S',i+1)
            elif j==1:
                print('H',i+1)
            elif j==2:
                print('C',i+1)
            elif j==3:
                print('D',i+1)