# Arup Guha
# 3/2/2020
# Another way to do a palidrome check


# Returns the reverse of string s.
def reverse(s):

    # Start with an empty string.
    ans = ""

    # One by one add characters to the front, which naturally reverses it.
    for i in range(len(s)):
        ans = s[i] + ans

    return ans

def isPal(s):

    # Just reverse it.
    revs = reverse(s)

    # A string is a palindrome only if it equals its reverse.
    return revs == s

# Test our isPal function.
def main():

    # Read in a string.
    word = input("Enter your string.\n")

    # Call isPal and return appropriately.
    if isPal(word):
        print(word,"is a palindrome")
    else:
        print(word,"is not a pal")

# Run it!
main()
