Given a list S consisting of strings separated by a space. Hash the list using the hash rule and a long string X given below and return the hash value.
String X: "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ".
Hash Rule: Hash is the summation of all the character values in the input: (currentIndex + (position of the character In the string initial) ). And then this hash is multiplied by the number of strings in the list.
 
Example 1:
Input:
S = aA1 b
Output:
132
Explanation: 
List is ["aA1", "b"]
a: 0 + 0 = 0
A: 1 + 36 = 37
1: 2 + 26 = 28
b: 0 + 1 = 1
So, 2*(0+1+37+28) = 2*(66) = 132
Example 2:
Input:
S = aa BB cc DD
Output:
640
Explanation: 
List is ["aa", "BB","cc","DD"]
a: 0 + 0 = 0
a: 1 + 0 = 1
B: 0 + 37 = 37
B: 1 + 37 = 38
c: 0 + 2 = 2
c: 1 + 2 = 3
D: 0 + 39 = 39
D: 1 + 39 = 40
So, 4*(0+1+37+38+2+3+39+40)= 4*(160)=640
 
Your Task:  
You don't need to read input or print anything. Your task is to complete the function hashString() which takes string S, list of space-separated strings as a parameter and returns the hash value of the list.
 
Expected Time Complexity: O(Sum of the length of all the strings)
Expected Auxiliary Space: O(Length of initial string)
 
Constraints:
1 ≤ Length of a string ≤ 30
1 ≤ Number of strings in a list ≤ 20

Source: geeksforgeeks | Difficulty: EASY
Tags: String algorithms

Data structures

Starter code: #User function Template for python3
class Solution:
    def hashString(self, S):
        # code here 


Solutions:
class Solution:

	def hashString(self, s):
		c = 0
		l = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		d = {}
		for i in range(len(l)):
			d[l[i]] = i
		t = s.split()
		for i in t:
			for j in range(len(i)):
				c += j + d[i[j]]
		c *= len(t)
		return c


class Solution:

	def hashString(self, S):
		x = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		ans = []
		a = S.split(' ')
		for i in a:
			for j in range(len(i)):
				ans.append(j + x.index(i[j]))
		return len(a) * sum(ans)


class Solution:

	def hashString(self, S):
		s = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		S = list(S.split())
		n = len(S)
		res = []
		for i in S:
			ss = 0
			for j in range(len(i)):
				ss += j + s.index(i[j])
			res.append(ss)
		ss = 0
		for i in res:
			ss += n * i
		return ss


class Solution:

	def hashString(self, S):
		initial = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		m = {}
		for i in range(len(initial)):
			m[initial[i]] = i
		S = S.strip().split()
		hash = 0
		for s in S:
			for i in range(len(s)):
				hash += m[s[i]] + i
		ans = hash * len(S)
		return ans


class Solution:

	def hashString(self, S):
		sum = 0
		l = S.split(' ')
		X = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		for i in l:
			for j in range(len(i)):
				sum += j + X.index(i[j])
		return len(l) * sum


class Solution:

	def hashString(self, S):
		target = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		lst = S.split(' ')
		ans = 0
		for i in lst:
			n = len(i)
			for j in range(n):
				ans += target.index(i[j])
				ans += j
		return ans * len(lst)


class Solution:

	def hashString(self, S):
		d = {}
		string = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		for i in range(len(string)):
			d[string[i]] = i
		summa = 0
		l = S.split()
		for item in l:
			for (i, char) in enumerate(item):
				summa += d[char] + i
		return summa * len(l)


class Solution:

	def hashString(self, S):
		s = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		d = {}
		for i in range(len(s)):
			d[s[i]] = i
		l = S.split()
		n = len(l)
		l1 = []
		for i in l:
			s1 = 0
			for j in range(len(i)):
				s1 += j + d[i[j]]
			l1.append(s1)
		return sum(l1) * n


class Solution:

	def hashString(self, S):
		X = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		s = list(S.split(' '))
		sum1 = 0
		for i in range(0, len(s)):
			j = 0
			while j < len(s[i]):
				index = X.index(s[i][j])
				sum1 += j + index
				j += 1
		return len(s) * sum1


class Solution:

	def hashString(self, S):
		string = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		arr = S.split()
		n = len(arr)
		res = 0
		for i in arr:
			for j in range(len(i)):
				res += j + string.index(i[j])
		return n * res


class Solution:

	def hashString(self, s):
		d = {}
		x = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		for i in range(len(x)):
			d[x[i]] = i
		ans = 0
		c = 0
		p = 1
		for i in s:
			if i in d:
				ans += c + d[i]
				c += 1
			else:
				c = 0
				p += 1
		return p * ans


class Solution:

	def hashString(self, S):
		m = {}
		t = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		c = 0
		for i in t:
			m[i] = c
			c += 1
		c = 0
		s = 0
		d = 0
		for i in S:
			if i != ' ':
				s += c + m[i]
				c += 1
			else:
				d += 1
				c = 0
		return (d + 1) * s


class Solution:

	def hashString(self, S):
		al = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		s = S.split()
		a = 0
		for i in range(len(s)):
			for j in range(len(s[i])):
				a += j + al.index(s[i][j])
		return len(s) * a


class Solution:

	def hashString(self, S):
		ht = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25, '1': 26, '2': 27, '3': 28, '4': 29, '5': 30, '6': 31, '7': 32, '8': 33, '9': 34, '0': 35, 'A': 36, 'B': 37, 'C': 38, 'D': 39, 'E': 40, 'F': 41, 'G': 42, 'H': 43, 'I': 44, 'J': 45, 'K': 46, 'L': 47, 'M': 48, 'N': 49, 'O': 50, 'P': 51, 'Q': 52, 'R': 53, 'S': 54, 'T': 55, 'U': 56, 'V': 57, 'W': 58, 'X': 59, 'Y': 60, 'Z': 61}
		s = list(S.split())
		n = len(s)
		ss = 0
		for i in range(n):
			x = 0
			for j in s[i]:
				ss += ht[j]
			x = len(s[i]) - 1
			ss += x * (x + 1) // 2
		return n * ss


class Solution:

	def hashString(self, s):
		es = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		l = 0
		s = list(s.split())
		for i in range(len(s)):
			for j in range(len(s[i])):
				l = l + es.index(s[i][j]) + j
		return len(s) * l


class Solution:

	def hashString(self, S):
		Sum = 0
		count = 0
		j = 0
		n = len(S)
		for i in range(n):
			if S[i] == ' ':
				count += 1
				j = 0
			else:
				if S[i].isalpha():
					if S[i].islower():
						Sum = Sum + j + ord(S[i]) - 97
					else:
						Sum = Sum + j + ord(S[i]) - 65 + 36
				elif S[i] == '0':
					Sum = Sum + 35 + j
				else:
					Sum = Sum + int(S[i]) + 25 + j
				j += 1
		return (count + 1) * Sum


class Solution:

	def hashString(self, S):
		x = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		r = S.split(' ')
		sum = 0
		for i in r:
			for j in range(len(i)):
				sum = sum + x.index(i[j]) + j
		return len(r) * sum


class Solution:

	def hashString(self, S):
		S = S.split()
		chek = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		has = 0
		step = 0
		for i in range(0, len(S)):
			for j in range(0, len(S[i])):
				step += j + chek.find(S[i][j])
		has = len(S) * step
		return has


class Solution:

	def hashString(self, S):
		x = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		arr = S.split(' ')
		ans = 0
		for i in arr:
			for j in range(len(i)):
				index = x.index(i[j])
				ans += j + index
		return len(arr) * ans
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		s = input()
		ob = Solution()
		print(ob.hashString(s))


class Solution:

	def hashString(self, S):
		X = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		updatedStr = S.split()
		sum = 0
		for i in range(len(updatedStr)):
			for j in range(len(updatedStr[i])):
				sum = sum + j + X.index(updatedStr[i][j])
		return len(updatedStr) * sum
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		s = input()
		ob = Solution()
		print(ob.hashString(s))


class Solution:

	def hashString(self, S):
		l = []
		s = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		s = list(s)
		S = S.split()
		a = 0
		for i in range(0, len(S)):
			for j in range(0, len(S[i])):
				a += j + s.index(S[i][j])
		return len(S) * a
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		s = input()
		ob = Solution()
		print(ob.hashString(s))


class Solution:

	def hashString(self, S):
		dict = {}
		x = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		for i in range(len(x)):
			dict[x[i]] = i
		sum = 0
		S = S.split()
		n = len(S)
		for i in range(len(S)):
			temp = S[i]
			j = 0
			while j < len(temp):
				sum += dict[temp[j]] + j
				j += 1
		return sum * n
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		s = input()
		ob = Solution()
		print(ob.hashString(s))


class Solution:

	def hashString(self, S):
		initial = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		words = S.split()
		totalHash = 0
		for word in words:
			index = 0
			for char in word:
				totalHash += index + initial.index(char)
				index += 1
		return totalHash * len(words)
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		s = input()
		ob = Solution()
		print(ob.hashString(s))


class Solution:

	def hashString(self, S):
		X = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		h = {}
		c = 0
		for i in X:
			h[i] = c
			c = c + 1
		query = S.split(' ')
		ans = 0
		for j in query:
			c = 0
			for i in j:
				ans = ans + c + int(h[i])
				c = c + 1
		return len(query) * ans
if __name__ == '__main__':
	t = int(input())
	for _ in range(t):
		s = input()
		ob = Solution()
		print(ob.hashString(s))


class Solution:

	def hashString(self, S):
		sum = 0
		hash = list('abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ')
		S = S.split()
		for i in range(len(S)):
			for j in range(len(S[i])):
				sum += j + hash.index(S[i][j])
		return len(S) * sum


class Solution:

	def hashString(self, S):
		hash_feq = {}
		hashVal = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		for i in range(len(hashVal)):
			hash_feq[hashVal[i]] = i
		add = 0
		S = S.split(' ')
		for i in range(len(S)):
			for j in range(len(S[i])):
				add += j + hash_feq[S[i][j]]
		return add * len(S)


class Solution:

	def hashString(self, S):
		ha = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		strings = S.split(' ')
		final = 0
		for st in strings:
			val = 0
			for i in range(len(st)):
				val = val + i + ha.find(st[i])
			final += val
		return final * len(strings)


class Solution:

	def hashString(self, S):
		w = S.split(' ')
		l1 = len(w)
		s = 0
		s1 = 0
		s2 = 0
		for i in w:
			l = list(i)
			for j in range(len(l)):
				if ord(l[j]) >= 97 and ord(l[j]) <= 122:
					d = ord(l[j]) - 97
					s2 = j + d
					s1 = s1 + s2
				elif ord(l[j]) >= 65 and ord(l[j]) <= 90:
					d = ord(l[j]) - 65
					d = d + 36
					s2 = j + d
					s1 = s1 + s2
				elif ord(l[j]) >= 49 and ord(l[j]) <= 57:
					d = ord(l[j]) - 49
					d = d + 26
					s2 = j + d
					s1 = s1 + s2
				elif l[j] == '0':
					d = 35
					s2 = j + d
					s1 = s1 + s2
		ans = l1 * s1
		return ans


class Solution:

	def hashString(self, S):
		S = S.split(' ')
		answer = 0

		def h(x):
			if ord(x) >= ord('a') and ord(x) <= ord('z'):
				return ord(x) - ord('a')
			if ord(x) >= ord('A') and ord(x) <= ord('Z'):
				return ord(x) - ord('A') + 36
			if ord(x) >= ord('1') and ord(x) <= ord('9'):
				return ord(x) - ord('1') + 26
			if ord(x) == ord('0'):
				return 35
		for string in S:
			for i in range(len(string)):
				answer += i + h(string[i])
		answer *= len(S)
		return answer


class Solution:

	def hashString(self, S):
		x = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		arr = S.split()
		n = len(arr)
		val = 0
		sum = 0
		for i in arr:
			currText = i
			for j in range(len(currText)):
				val = j + x.index(currText[j])
				sum += n * val
		return sum


class Solution:

	def hashString(self, S):
		x = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		li = list(S.split(' '))
		j = 0
		s = 0
		for i in range(len(S)):
			if S[i] == ' ':
				j = 0
			else:
				s = s + j + x.index(S[i])
				j += 1
		return len(li) * s


class Solution:

	def hashString(self, S):
		x = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		y = [i for i in range(len(x))]
		d = {}
		for (i, j) in zip(x, y):
			d[i] = j
		l = []
		cur = ''
		for i in S:
			if i == ' ':
				l.append(cur)
				cur = ''
			else:
				cur += i
		if cur:
			l.append(cur)
		ans = 0
		for i in l:
			for j in range(len(i)):
				ans += j
				ans += d[i[j]]
		return ans * len(l)


class Solution:

	def hashString(self, S):
		m = 0
		X = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		s = S.split(' ')
		for i in s:
			for j in range(len(i)):
				if i[j] in X:
					m += j
					m += X.index(i[j])
		return m * len(s)


class Solution:

	def hashString(self, S):
		a = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		dict = {}
		sum = 0
		for i in range(len(a)):
			dict[a[i]] = i
		s = [i for i in S.split()]
		for i in s:
			for j in range(len(i)):
				sum += j + dict[i[j]]
		return sum * len(s)


class Solution:

	def hashString(self, S):
		list1 = S.split(' ')
		ans = 0
		x = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		for s in list1:
			for i in range(len(s)):
				ans += i + x.index(s[i])
		return ans * len(list1)


class Solution:

	def hashString(self, S):
		s = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		count = 0
		index = 0
		num = S.split(' ')
		n = len(num)
		for i in range(len(S)):
			if S[i] == ' ':
				index = 0
			else:
				count = count + (index + s.index(S[i]))
				index = index + 1
		count = count * n
		return count


class Solution:

	def hashString(self, S):
		S = S.split()
		c = 0
		X = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		for i in range(len(S)):
			for j in range(len(S[i])):
				c += j + X.find(S[i][j])
		return c * len(S)


class Solution:

	def hashString(self, S):
		gg = {}
		a = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		for i in range(len(a)):
			if a[i] not in gg:
				gg[a[i]] = i
		b = S.split(' ')
		s = 0
		for string in b:
			for j in range(len(string)):
				s += j + gg[string[j]]
		return s * len(b)


class Solution:

	def hashString(self, S):
		s1 = 0
		a = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		b = S.split(' ')
		for i in range(len(b)):
			l = b[i]
			for j in range(len(l)):
				s1 = s1 + (j + a.index(l[j]))
		return s1 * len(b)


class Solution:

	def hashString(self, S):
		sum = 0
		X = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		lst = S.split()
		for i in lst:
			for x in range(len(i)):
				sum += x + X.find(i[x])
		return len(lst) * sum


class Solution:

	def hashString(self, S):
		X = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		wordCount = 1
		sm = 0
		curIndx = 0
		for i in S:
			if i == ' ':
				wordCount += 1
				curIndx = 0
			else:
				sm += curIndx + X.find(i)
				curIndx += 1
		res = wordCount * sm
		return res


class Solution:

	def hashString(self, S):
		sss = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		cou = 0
		for i in S.split():
			for j in range(len(i)):
				cou += j + sss.index(i[j])
		return len(S.split()) * cou


class Solution:

	def hashString(self, S):
		s = 0
		j = 0
		d = -1
		n = 1
		for i in range(len(S)):
			d = d + 1
			if S[i] == ' ':
				d = -1
				n = n + 1
			if ord(S[i]) >= 65 and ord(S[i]) <= 90:
				s = s + d + ord(S[i]) - 65 + 36
			elif ord(S[i]) >= 97 and ord(S[i]) <= 122:
				s = s + d + ord(S[i]) - 97
			elif ord(S[i]) >= 49 and ord(S[i]) <= 57:
				s = s + d + ord(S[i]) - 49 + 26
			elif S[i] == '0':
				s = s + d + 35
		return s * n


class Solution:

	def hashString(self, S):
		c = 0
		x = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		s = S.split()
		for i in range(len(s)):
			y = s[i]
			for j in range(len(y)):
				c += j + x.index(y[j])
		return len(s) * c


class Solution:

	def hashString(self, S):
		t_string = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		S_list = S.split(' ')
		sum = 0
		for i in range(len(S_list)):
			for j in range(len(S_list[i])):
				sum = sum + j + t_string.index(S_list[i][j])
		return len(S_list) * sum


class Solution:

	def hashString(self, S):
		X = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		c = 1
		Sum = 0
		a = 0
		for i in range(0, len(S)):
			if S[i] == ' ':
				c = c + 1
				a = 0
			else:
				Sum = Sum + (a + X.find(S[i]))
				a = a + 1
		return c * Sum


class Solution:

	def hashString(self, S):
		c1 = S.count(' ') + 1
		l = len(S)
		i = 0
		sum1 = 0
		hash1 = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		list1 = list(map(str, S.split()))
		for i in range(len(list1)):
			for j in range(len(list1[i])):
				if list1[i][j] in hash1:
					sum1 = sum1 + j + hash1.index(list1[i][j])
		return c1 * sum1


class Solution:

	def hashString(self, S):
		X = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		space = 1
		res = 0
		for i in S:
			if i == ' ':
				space += 1
		pos = 0
		for i in range(len(S)):
			if S[i] == ' ':
				pos = 0
			if S[i] != ' ':
				res += pos
				pos += 1
				for j in range(len(X)):
					if S[i] == X[j]:
						res += j
		return space * res


class Solution:

	def hashString(self, S):
		x = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		s = S.split(' ')
		sm = []
		l = []
		for i in s:
			for (id, j) in enumerate(i):
				if j in x:
					sm.append(id)
					sm.append(x.index(j))
		return len(s) * sum(sm)


class Solution:

	def hashString(self, S):
		SX = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		mapping = {}
		for i in range(len(SX)):
			mapping[SX[i]] = i
		s = S.split(' ')
		sum = 0
		for i in s:
			for j in range(len(i)):
				sum += j + mapping[i[j]]
		return len(s) * sum


class Solution:

	def hashString(self, S):
		s = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		x = S.split()
		result = []
		for i in x:
			for j in i:
				c = i.count(j)
				if c == 1:
					z = i.index(j) + s.index(j)
					result.append(z)
				else:
					z = i.index(j) + s.index(j)
					result.append(z)
					i = i.replace(j, '%', 1)
		return len(x) * sum(result)


class Solution:

	def hashString(self, S):
		s2 = S.split(' ')
		c = 0
		x = 'abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'
		l2 = list(x)
		d = {}
		lists = []
		for (ind, item) in enumerate(l2):
			d[item] = ind
		for item in s2:
			l = list(item)
			for (ind, ele) in enumerate(l):
				c = c + (ind + d[ele])
		return len(s2) * c