# ---
# title: 564. Find the Closest Palindrome
# id: problem564
# author: Tian Jun
# date: 2020-10-31
# difficulty: Hard
# categories: String
# link: <https://leetcode.com/problems/find-the-closest-palindrome/description/>
# hidden: true
# ---
# 
# Given an integer n, find the closest integer (not including itself), which is
# a palindrome.
# 
# The 'closest' is defined as absolute difference minimized between two
# integers.
# 
# **Example 1:**  
# 
#     
#     
#     Input: "123"
#     Output: "121"
#     
# 
# **Note:**  
# 
#   1. The input **n** is a positive integer represented by string, whose length will not exceed 18.
#   2. If there is a tie, return the smaller one as answer.
# 
# 
## @lc code=start
using LeetCode

## add your code here:
## @lc code=end
