{"raw_statement":[{"iden":"statement","content":"A string is considered palindrome if it's the same if you read it from the left or from the right (if it stays the same when you reverse it).\n\nIn this problem you are given a string, and your task is to swap 2 characters at different positions to make the string palindrome (note that you must do this step exactly once).\n\nThe input contains just 1 line which is the string you are going to check, the string consists of at least 2 and at most 500,000 lower case English letters.\n\nPrint \"YES\" if you can make the given string palindrome by applying the above step exactly once, otherwise print \"NO\".\n\nIn the second test case, you can swap the first and last characters (which won't make any change), and the string will stay palindrome.\n\nP.S. The judge is cute enough today and didn't allow strings with length 1.\n\n"},{"iden":"input","content":"The input contains just 1 line which is the string you are going to check, the string consists of at least 2 and at most 500,000 lower case English letters."},{"iden":"output","content":"Print \"YES\" if you can make the given string palindrome by applying the above step exactly once, otherwise print \"NO\"."},{"iden":"examples","content":"InputabOutputNOInputabaOutputYESInputaxaxOutputYES"},{"iden":"note","content":"In the second test case, you can swap the first and last characters (which won't make any change), and the string will stay palindrome.P.S. The judge is cute enough today and didn't allow strings with length 1."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case $ i \\in \\{1, \\dots, T\\} $, let $ n_i \\in \\mathbb{Z} $ be the total number of tabs and $ k_i \\in \\mathbb{Z} $ be the index of the contest tab ($ 1 \\leq k_i \\leq n_i \\leq 100 $).\n\n**Constraints**  \n1. $ 1 \\leq T \\leq 5050 $  \n2. For each test case: $ 1 \\leq k_i \\leq n_i \\leq 100 $\n\n**Objective**  \nFor each test case, compute the minimum number of clicks to close all tabs except tab $ k_i $, given:  \n- Clicking the **\"Close Other Tabs\"** button closes all tabs except the currently selected one.  \n- Clicking a tab selects it (and may trigger \"Close Left\" or \"Close Right\" if available).  \n- Only two operations are allowed:  \n  - **Close Left**: Close all tabs to the left of the current tab.  \n  - **Close Right**: Close all tabs to the right of the current tab.  \n\nAssume that selecting a tab is free, and each \"Close Left\" or \"Close Right\" action counts as one click.\n\nTo minimize clicks:  \n- Close all tabs to the left of $ k_i $: requires $ 1 $ click (if any exist).  \n- Close all tabs to the right of $ k_i $: requires $ 1 $ click (if any exist).  \n\nThus, the minimum number of clicks is:  \n$$\n\\begin{cases}\n0 & \\text{if } n_i = 1 \\\\\n1 & \\text{if } k_i = 1 \\text{ or } k_i = n_i \\text{ and } n_i > 1 \\\\\n2 & \\text{if } 1 < k_i < n_i\n\\end{cases}\n$$\n\nEquivalently:  \n$$\n\\text{Answer} = \\begin{cases} \n0 & \\text{if } n = 1 \\\\\n1 & \\text{if } k = 1 \\text{ or } k = n \\\\\n2 & \\text{otherwise}\n\\end{cases}\n$$","simple_statement":"You have n tabs in a row, numbered 1 to n. Tab k is the one you want to keep. You can close all tabs to the left of k with one click, and all tabs to the right of k with one click. What’s the minimum number of clicks to close all tabs except tab k?","has_page_source":false}