palindromic-ciphers
Source: hackerearth
Difficulty: EASY

Julius Cipher is a type of cipher which relates all the lowercase alphabets to their numerical position in the alphabet, i.e., value of a is 1, value of b is 2, value of z is 26 and similarly for the rest of them. 

Little Chandan is obsessed with this Cipher and he keeps converting every single string he gets, to the final value one gets after the multiplication of the Julius Cipher values of a string. Arjit is fed up of Chandan's silly activities, so he decides to at least restrict Chandan's bad habits. 

So, he asks Chandan not to touch any string which is a palindrome, otherwise he is allowed to find the product of the Julius Cipher values of the string.

Input: 
The first line contains t number of test cases. The first line of every test case contains a string, S.  

Output: 
 Print the value if the string is not a palindrome, otherwise print Palindrome - where value is equal to the product of all the characters of Julius Cipher values.

Constraints:
1 ≤ T ≤ 10^2
1 ≤ length of the string ≤ 10  

Note:
The string will contain only lowercase letters.

SAMPLE INPUT
2
zazaz
goodarjit

SAMPLE OUTPUT
Palindrome
204120000


t=int(input())
while t:
	a=input()
	b=a[::-1]
	r=1
	if(a==b):
		print("Palindrome")
	else:
		for i in a:
			r=r*(ord(i)-96)
		print(r)
	t=t-1


import string
t=int(input())
for w in range(t):
	s=input()
	b=len(s)
	if b % 2 != 0:
		s1=s[b/2+1::]
		s2=s[:b/2]
	else:
		s1=s[b/2::]
		s2=s[:b/2]
	if s1[::-1] == s2:
		print('Palindrome')
	else:
		values = dict()
		for index, letter in enumerate(string.ascii_lowercase):
			   values[letter] = index + 1
		mul=1
		for i in s:
			mul=mul*values[i]
		print(mul)


t=input()
alfa={'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7,'h':8,'i':9,'j':10,'k':11,'l':12,'m':13,'n':14,'o':15,'p':16,'q':17,'r':18,'s':19,'t':20,'u':21,'v':22,'w':23,'x':24,'y':25,'z':26}

for i in range(0,int(t)):
	s=input()
	pal=s[::-1]
	
	if s==pal:
		print('Palindrome')
	else:
		tot=1
		for c in s:
			tot*=alfa[c]
		print(tot)
		
		


import sys
data = {'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7,'h':8,'i':9,'j':10,'k':11,'l':12,'m':13,'n':14,'o':15,'p':16,'q':17,'r':18,'s':19,'t':20,'u':21,'v':22,'w':23,'x':24,'y':25,'z':26}
t=int(sys.stdin.readline().strip())
while t>0:
	s=sys.stdin.readline().strip()
	if s==s[::-1]:
		print('Palindrome')
	else:
		p=1
		for l in list(s):
			p*=data[l]
		print(p)      
	t-=1 


l=['abcdefghijklmnopqrstuvwxyz']
l2=[]
for i in range(int(eval(input()))):
	s=input()
	product=1
	if(s==s[::-1]):
		print("Palindrome")
	else:
		l1=[]
		product=1
		for m in range(0,len(s)):
			c=1
			for k in range(0,len(l[0])):
				if(s[m]==l[0][k]):
					break;
				else:
					c+=1
			l1.append(c)
		for z in range(0,len(l1)):
			product*=l1[z]
		print(product)
		
				


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
n = int(input())
i = 0
p = 1
while i < n:
	tc = input()
	
	if tc == tc[::-1]:
		print("Palindrome")
	else:
		for x in tc:
			p *= ord(x)-96
		print(p)
		p = 1
	i += 1


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
from functools import reduce

t = int(input())
for _ in range(t):
	word = input()
	if word == word[::-1]:
		print("Palindrome")
	else:
		print(reduce(lambda x,y: x*y, (ord(letter) - ord("a") + 1 for letter in word)))


t = eval(input())
for i in range(t):
	s = input()
	if s==s[::-1]:
		print('Palindrome')
	else:
		c = 1
		for j in s:
			c*=(ord(j)-96)
		print(c)


from collections import defaultdict
t=eval(input())
for i in range(t):
	s=input()
	s1=s[::-1]
	if s1==s:
		print("Palindrome")
	else:
		d={'a':1,'b':2,'c':3,'d':4,'e':5,'f':6,'g':7,'h':8,'i':9,'j':10,'k':11,'l':12,'m':13,'n':14,'o':15,'p':16,'q':17,'r':18,'s':19,'t':20,'u':21,'v':22,'w':23,'x':24,'y':25,'z':26}
		count=1
		for j in s:
			if j in d:
				count*=d[j]
		print(count)
			
		


N = int(input())

CS = {}

for i in range(1, 27):
	CS[chr(96+i)] = i

def mul(s):
	p = 1
	for i in s:
		p *= CS[i]
	return p

def pal(s):
	return s[::-1]==s

for i in range(N):
	name = input()
	print('Palindrome' if pal(name) else mul(name))


def getval(y):
	count=1
	for x in range(len(y)):
		count*=ord(y[x])-96
	return count
for _ in range(eval(input())):
	y = input()
	if y[::]==y[::-1]:
		print("Palindrome")
	else:
		print(getval(y))


from functools import reduce
for _ in range(eval(input())):
	s = input()
	if s == s[::-1]:
		print("Palindrome")
	else:
		print(reduce(lambda x,y:x*y, [ord(c) - ord('a') + 1for c in s], 1))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
from functools import reduce
t = int(input())
for kappa in range(t):
	string = input()
	if string == string[::-1]:
		print('Palindrome')
	else:
		l = [ord(letter)-96 for letter in string]
		print(reduce(lambda x,y:x*y, l))


import string

alphabets = list(string.lowercase)
digits = [i for i in range(1,27)]

usecase = {}

for i,j in zip(alphabets,digits):
	usecase[i] = j

n = eval(input())
for i in range(n):
	product = 1
	user_input = input()
	if list(user_input) == list(user_input)[::-1]:
		print("Palindrome")
	else:
		for j in list(user_input):
			product = product * usecase.get(j)
		print(product)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
for i in range(eval(input())):
	z=input()
	ans=1
	if(z==z[::-1]):
		print("Palindrome")
	else:
		for i in z:
			ans=ans*(ord(i)-96)
		print(ans)


import string
smaAlp = list(string.ascii_lowercase)

testCases = input()

while testCases > 0 :
	mult = 1
	palStr = input()
	if str(palStr) == str(palStr)[::-1] :
		print("Palindrome")
	else :
		for i in palStr :
			mult *= int(smaAlp.index(i)) +1
		print(mult)
		
	testCases = int(testCases) - 1


def checkPalindrome(string):
	s1  = string[::-1]
	if s1 == string:
		return True
	return False
def getCipher(element):
	return ord(element) - 96

n = int(input())
for i in range(0,n):
	string = input()
	if checkPalindrome(string):
		print("Palindrome")
	else:
		product = 1
		for elm in string:
			product *= getCipher(elm)
		print(product) 


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t = int(input())
while(t>0):
	s = input()
	s = list(s)
	c=0
	for i in range(len(s)/2):
		if s[i]==s[len(s)-1-i]:
			c+=1
		else:
			break
	if c==(len(s)/2):
		print("Palindrome")
	else:
		c=1
		for i in range(len(s)):
			c=c*(ord(s[i])-ord('a')+1)
		print(c)
	t-=1


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t = int(input())
dc = {
	"a":1,
	"b":2,
	"c":3,
	"d":4,
	"e":5,
	"f":6,
	"g":7,
	"h":8,
	"i":9,
	"j":10,
	"k":11,
	"l":12,
	"m":13,
	"n":14,
	"o":15,
	"p":16,
	"q":17,
	"r":18,
	"s":19,
	"t":20,
	"u":21,
	"v":22,
	"w":23,
	"x":24,
	"y":25,
	"z":26,
	}
for i in range(t):
	s = input().lower()
	if s==s[::-1]:
		print("Palindrome")
	else:
		res = 1
		for j in s:
			res *= dc[j]
		print(res)


import string

alps = {}
lows = string.lowercase
for i in range(len(lows)):
	alps[lows[i]] = i + 1


def calcProduc(st):
	prod = 1
	for i in st:
		prod *= alps[i]

	return prod


def isPalindrome(st):
	l = len(st)
	subl = l // 2
	m = l % 2
	first = st[:subl]
	end = st[(subl + m):]
	if first != end[::-1]:
		return False
	return True


t = eval(input())

for i in range(t):
	st = input().strip()
	if isPalindrome(st):
		print("Palindrome")
	else:
		print(calcProduc(st))