codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

798A.md (932B)


      1 Source: https://codeforces.com/problemset/problem/798/A
      2 
      3 A. Mike and palindrome
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Mike has a string *s* consisting of only lowercase English letters. He wants to change exactly one character from the string so that the resulting one is a palindrome.
     22 
     23 A palindrome is a string that reads the same backward as forward, for example strings "z", "aaa", "aba", "abccba" are palindromes, but strings "codeforces", "reality", "ab" are not.
     24 
     25 Input
     26 
     27 The first and single line contains string *s* (1 ≤ |*s*| ≤ 15).
     28 
     29 Output
     30 
     31 Print "YES" (without quotes) if Mike can change exactly one character so that the resulting string is palindrome or "NO" (without quotes) otherwise.
     32 
     33 Examples
     34 
     35 Input
     36 
     37 ```
     38 abccaa
     39 ```
     40 
     41 Output
     42 
     43 ```
     44 YES
     45 ```
     46 
     47 Input
     48 
     49 ```
     50 abbcca
     51 ```
     52 
     53 Output
     54 
     55 ```
     56 NO
     57 ```
     58 
     59 Input
     60 
     61 ```
     62 abcda
     63 ```
     64 
     65 Output
     66 
     67 ```
     68 YES
     69 ```