A simple string contains a large repetition of letters within it. This problem is related to string handling and manipulation.  An original message is sent from planet Earth to planet Cybertron in form of a string. However, the letter position and string size is not important. The number of time each letter has occurred in the string is important. So the original string which is sent to Cybertron is encrypted in the new string which comprises the letters followed by each time it has occurred in the original string. Eg- original message is- abcdabf. Then the encrypted string is- a2b2c1d1f1

-----Input-----
The input consists of a single line string without any space or numeric or special characters.

-----Output-----
It will consist of in the encrypted string which comprises the letters followed by each time it has occurred in the original string in order.

-----Example-----
Input:
information

Output:
i2n2f1o2r1m1a1t1

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
import sys, math

def main(filename):
	inputfile = open(filename, 'rU')
	data = inputfile.readlines()
	T = data.pop(0)
	ans = []
	ansstring = str()
	explored = []
	for i in T:
		if i in explored:
			for j in range(len(ans)):
				if ans[j][0] == i:
					ans[j][1] += 1
		else:
			ans.append([i, 1])
			explored.append(i)
	for i in ans:
		ansstring += i[0] + str(i[1])
	print(ansstring)
	inputfile.close()

def __starting_point():
	main(sys.argv[1])
__starting_point()


def remove_double(s):
	s.reverse()
	temp = list(set(s))
	for i in temp:
		t = s.count(i)
		for _ in range(t - 1):
			s.remove(i)
	s.reverse()
	return s
message = input().strip().lower()
alpha = remove_double(list(message))
l = len(alpha)
encrypted = ''
for i in range(l):
	times = message.count(alpha[i])
	encrypted += alpha[i] + str(times)
print(encrypted)


import sys

def main():
	s = sys.stdin.readline
	string = s().strip()
	save = {}
	for i in string:
		if i in save:
			save[i] += 1
		else:
			save[i] = 1
	output = ''
	x = set()
	for i in string:
		if i not in x:
			output += i
			output += str(save[i])
			x.add(i)
	print(output)

def __starting_point():
	main()
__starting_point()