# Task
 Pero has been into robotics recently, so he decided to make a robot that checks whether a deck of poker cards is complete.

 He’s already done a fair share of work - he wrote a programme that recognizes the suits of the cards. For simplicity’s sake, we can assume that all cards have a suit and a number.

 The suit of the card is one of the characters `"P", "K", "H", "T"`, and the number of the card is an integer between `1` and `13`. The robot labels each card in the format `TXY` where `T` is the suit and `XY` is the number. If the card’s number consists of one digit, then X = 0. For example, the card of suit `"P"` and number `9` is labelled `"P09"`.

 A complete deck has `52` cards in total. For each of the four suits there is exactly one card with a number between `1` and `13`.

 The robot has read the labels of all the cards in the deck and combined them into the string `s`.
 
 Your task is to help Pero finish the robot by writing a program that reads the string made out of card labels and returns the number of cards that are missing for each suit.

 If there are two same cards in the deck, return array with `[-1, -1, -1, -1]` instead.

# Input/Output


 - `[input]` string `s`

  A correct string of card labels. 0 ≤ |S| ≤ 1000


 - `[output]` an integer array

  Array of four elements, representing the number of missing card of suits `"P", "K", "H", and "T"` respectively. If there are two same cards in the deck, return `[-1, -1, -1, -1]` instead.


# Example

 For `s = "P01K02H03H04"`, the output should be `[12, 12, 11, 13]`.
 
 `1` card from `"P"` suit, `1` card from `"K"` suit, `2` cards from `"H"` suit, no card from `"T"` suit.
 
 For `s = "H02H10P11H02"`, the output should be `[-1, -1, -1, -1]`.
 
 There are two same cards `"H02"` in the string `s`.

Difficulty: EASY
Starter code: def cards_and_pero(s):
	

Solutions:
from collections import defaultdict

def cards_and_pero(s):
	deck = defaultdict(set)
	for n in range(0, len(s), 3):
		card = s[n:n + 3]
		if card[1:] in deck[card[0]]:
			return [-1, -1, -1, -1]
		deck[card[0]] |= {card[1:]}
	return [13 - len(deck[suit]) for suit in 'PKHT']


from collections import Counter

def cards_and_pero(s):
	return [13 - s.count(c) for c in 'PKHT'] if max(Counter([s[i * 3:i * 3 + 3] for i in range(len(s) // 3)]).values()) <= 1 else [-1, -1, -1, -1]


def cards_and_pero(s):
	cards = [s[i - 3:i] for i in range(3, len(s) + 1, 3)]
	if len(set(cards)) < len(cards):
		return [-1, -1, -1, -1]
	return [13 - len([card[0] for card in cards if card[0] == suit]) for suit in 'PKHT']


def cards_and_pero(s):
	(d, records) = ({'P': 13, 'K': 13, 'H': 13, 'T': 13}, [])
	for i in range(0, len(s), 3):
		t = s[i:i + 3]
		if t in records:
			return [-1] * 4
		records.append(t)
		d[t[0]] -= 1
	return list(d.values())


from collections import Counter

def cards_and_pero(s):
	xs = [s[i:i + 3] for i in range(0, len(s), 3)]
	if len(xs) != len(set(xs)):
		return [-1, -1, -1, -1]
	suit = Counter(s[::3])
	return [13 - suit[c] for c in 'PKHT']


def cards_and_pero(s):
	cards = [(s[i], s[i + 1:i + 3]) for i in range(0, len(s), 3)]
	if len(set(cards)) != len(cards):
		return [-1] * 4
	result = [13] * 4
	for (suit, num) in cards:
		result['PKHT'.index(suit)] -= 1
	return result


import re
from collections import Counter

def cards_and_pero(s):
	cardDeck = re.findall('([PKHT])(\\d{2})', s)
	cnt = Counter((suit for (suit, _) in cardDeck))
	return [-1] * 4 if len(set(cardDeck)) != len(cardDeck) else [13 - cnt[suit] for suit in 'PKHT']


import re

def cards_and_pero(s):
	s = re.findall('...', s)
	if len(s) != len(set(s)):
		return [-1, -1, -1, -1]
	else:
		(P, K, H, T) = (13, 13, 13, 13)
		for x in s:
			if x[0] == 'P':
				P -= 1
			elif x[0] == 'K':
				K -= 1
			elif x[0] == 'H':
				H -= 1
			elif x[0] == 'T':
				T -= 1
		return [P, K, H, T]


def cards_and_pero(s):
	c = 0
	d = ''
	rtr = [13, 13, 13, 13]
	for i in range(len(s)):
		d = d + s[i]
		c += 1
		if c == 3:
			if d in s[i + 1:] or d in s[:i - 1]:
				return [-1, -1, -1, -1]
			if d[0] == 'P':
				rtr[0] -= 1
			elif d[0] == 'K':
				rtr[1] -= 1
			elif d[0] == 'H':
				rtr[2] -= 1
			elif d[0] == 'T':
				rtr[3] -= 1
			d = ''
			c = 0
	return rtr


def cards_and_pero(s):
	c = 0
	d = ''
	rtr = [13, 13, 13, 13]
	l = []
	for i in range(len(s)):
		d = d + s[i]
		c += 1
		if c == 3:
			l.append(d)
			if d in s[i + 1:] or d in s[:i - 1]:
				return [-1, -1, -1, -1]
			d = ''
			c = 0
	print(l)
	while len(l) > 0:
		if l[-1][0] == 'P':
			rtr[0] -= 1
			del l[-1]
		elif l[-1][0] == 'K':
			rtr[1] -= 1
			del l[-1]
		elif l[-1][0] == 'H':
			rtr[2] -= 1
			del l[-1]
		elif l[-1][0] == 'T':
			rtr[3] -= 1
			del l[-1]
	return rtr