### Description
As hex values can include letters `A` through to `F`, certain English words can be spelled out, such as `CAFE`, `BEEF`, or `FACADE`.
This vocabulary can be extended by using numbers to represent other letters, such as `5EAF00D`, or `DEC0DE5`.

Given a string, your task is to return the decimal sum of all words in the string that can be interpreted as such hex values.


### Example

Working with the string `BAG OF BEES`:  
* `BAG` ==> `0` as it is not a valid hex value  
* `OF` ==> `0F` ==> `15`  
* `BEES` ==> `BEE5` ==> `48869`

So `hex_word_sum('BAG OF BEES')` returns the sum of these, `48884`.


### Notes
* Inputs are all uppercase and contain no punctuation
* `0` can be substituted for `O`
* `5` can be substituted for `S`

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def hex_word_sum(s):
	

Solutions:
def hex_word_sum(s):
	return sum((int(w, 16) for w in s.translate(str.maketrans('OS', '05')).split() if set(w) <= set('0123456789ABCDEF')))


def hex_word_sum(string):
	sum = 0
	for word in string.upper().replace('S', '5').replace('O', '0').split(' '):
		try:
			sum += int(word.strip(), 16)
		except:
			pass
	return sum


def hex_word_sum(s):
	return sum((int(w, 16) for w in s.replace('O', '0').replace('S', '5').split() if all((c in '0123456789ABCDEF' for c in w))))


import re

def hex_word_sum(s):
	s = s.translate(str.maketrans('OS', '05'))
	return sum((int(x, 16) for x in re.findall('\\b[\\dA-F]+\\b', s)))


def hex_word_sum(string):
	string = string.replace('O', '0')
	string = string.replace('S', '5')
	new = string.split()
	sum = 0
	for i in new:
		try:
			v = int(i, 16)
		except:
			v = 0
		sum = sum + v
	return sum


def hex_word_sum(stg):
	valid_chars = set('05ABCDEF')
	stg = stg.replace('S', '5').replace('O', '0')
	valid_words = (word for word in stg.split() if not set(word) - valid_chars)
	return sum((int(word, 16) for word in valid_words))


def hex_word_sum(s):
	total = 0
	for word in s.replace('O', '0').replace('S', '5').split():
		try:
			total += int(word, 16)
		except ValueError:
			pass
	return total


def hex_word_sum(string):
	string = string.translate(string.maketrans('OS', '05')).split()
	return sum((int(i, 16) for i in string if set(i) <= set('0123456789ABCDEF')))


def hex_word_sum(string, res=0):
	s = string.replace('O', '0').replace('S', '5').split()
	for i in s:
		try:
			res += int(i, 16)
		except:
			pass
	return res