Given a string `S` and a character `C`, return an array of integers representing the shortest distance from the current character in `S` to `C`.

### Notes

* All letters will be lowercase.
* If the string is empty, return an empty array.
* If the character is not present, return an empty array.

## Examples

```python
shortest_to_char("lovecodewars", "e") == [3, 2, 1, 0, 1, 2, 1, 0, 1, 2, 3, 4]
shortest_to_char("aaaabbbb", "b") == [4, 3, 2, 1, 0, 0, 0, 0]
shortest_to_char("", "b") == []
shortest_to_char("abcde", "") == []
```

___

If you liked it, please rate  :D

Difficulty: EASY
Starter code: def shortest_to_char(s, c):
	

Solutions:
def shortest_to_char(s, c):
	if not s or not c:
		return []
	indexes = [i for (i, ch) in enumerate(s) if ch == c]
	if not indexes:
		return []
	return [min((abs(i - ic) for ic in indexes)) for i in range(len(s))]


def shortest_to_char(s, c):
	L = [i for (i, x) in enumerate(s) if x == c]
	return [min((abs(i - j) for j in L)) for (i, x) in enumerate(s)] if L else []


def shortest_to_char(s, c):
	return [min((x.find(c) + 1 or 1000.0 for x in [s[i:], s[:i + 1][::-1]])) - 1 for i in range(len(s))] if c and c in s else []


def shortest_to_char(s, c):
	if not c:
		return []
	l = []
	for (i, x) in enumerate(s):
		(a, b) = (s[i:].find(c), s[:i + 1][::-1].find(c))
		if a != -1:
			a = abs(i - i + a)
		else:
			a = float('inf')
		if b != -1:
			b = s[:i + 1][::-1].find(c)
		else:
			b = float('inf')
		get_min = min(a, b)
		if get_min != float('inf'):
			l.append(get_min)
	return l


import re

def shortest_to_char(s, c):
	if not c or c not in s:
		return []
	positions = [m.start() for m in re.finditer(c, s)]
	return [min((abs(p - i) for p in positions)) for i in range(len(s))]


def shortest_to_char(alist, target):
	loc = [i for (i, x) in enumerate(alist) if x == target]
	if not loc:
		return []
	shortest = [min((abs(i - l) for l in loc)) for i in range(len(alist))]
	return shortest


def shortest_to_char(s, c):
	if not (s and c and (c in s)):
		return []
	idxs = [i for (i, x) in enumerate(s) if x == c]
	return [min((abs(j - i) for j in idxs)) for (i, x) in enumerate(s)]


def shortest_to_char(s, c):
	i = s.find(c)
	if i == -1 or not c:
		return []
	lst = list(reversed(range(1, i + 1)))
	while i != -1:
		j = s.find(c, i + 1)
		if j == -1:
			lst.extend(range(len(s) - i))
		else:
			x = j - i >> 1
			lst.extend(range(0, x + 1))
			lst.extend(reversed(range(1, j - i - x)))
		i = j
	return lst


def shortest_to_char(s, c):
	if not s or not c:
		return []
	a = [i for (i, x) in enumerate(s) if x == c]
	if not a:
		return []
	(r, n) = ([0] * len(s), 0)
	for (x, y) in zip(a, a[1:] + [None]):
		m = (x + y + 1) // 2 if y is not None else len(s)
		while n < m:
			r[n] = abs(n - x)
			n += 1
	return r


def shortest_to_char(s, c):
	if not c in s or not c:
		return []
	return [0 if c == s[x] else min([abs(x - y) for y in [x for x in range(len(s)) if s[x] == c]]) for x in range(len(s))]