# Template for Palindrome inputFile = open("palin.txt", "r") outputFile = open("palout.txt", "w") # Read in the input N = int(inputFile.readline()) # "readline" also includes the newline marking the end of the line (if there is one). # We add a .strip() which gets rid of it for us. line = inputFile.readline().strip() # Convert the string to a list so we can modify it line = list(line) # The characters of the palindrome are line[0], line[1], ..., line[N-1] # TODO: Solve the problem # Convert back to a string for printing line = "".join(line) outputFile.write(line) inputFile.close() outputFile.close()