Return an output string that translates an input string `s`/`$s` by replacing each character in `s`/`$s` with a number representing the number of times that character occurs in `s`/`$s` and separating each number with the character(s) `sep`/`$sep`.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def freq_seq(s, sep):
	

Solutions:
def freq_seq(s, sep):
	return sep.join([str(s.count(i)) for i in s])


from collections import Counter

def freq_seq(s, sep):
	freq = Counter(s)
	return sep.join((str(freq[c]) for c in s))


from collections import Counter

def freq_seq(string, separator):
	count = Counter(string)
	return separator.join((str(count[symbol]) for symbol in string))


def freq_seq(s, sep):
	return sep.join((str(s.count(c)) for c in s))


from collections import Counter

def freq_seq(s, sep):
	dic = Counter(s)
	result = ''
	for char in s:
		for (key, value) in list(dic.items()):
			if char == key:
				result += str(value) + sep
	return result[:-1]


from collections import Counter

def freq_seq(string, sep):
	counter = Counter(string)
	return sep.join((str(counter[char]) for char in string))


def freq_seq(s, sep):
	numero = len(s)
	conta = 0
	contatore = 0
	contatore1 = 0
	lista = []
	while conta != numero:
		z = str(s[conta])
		while contatore1 < numero:
			if z == s[contatore1]:
				contatore += 1
			contatore1 += 1
		contatore1 = 0
		lista.append(str(contatore))
		contatore = 0
		conta += 1
	x = sep.join(lista)
	return x


def freq_seq(s, sep):
	return sep.join([str(s.count(letter)) for letter in s])


def freq_seq(s, sep):
	freq = {}
	newStr = []
	for i in s:
		if freq.get(i) == None:
			freq[i] = 1
		else:
			freq[i] += 1
	for i in s:
		newStr.append(str(freq[i]))
	return sep.join(newStr)