Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     freopen("input.txt", "r", stdin);
  9.     freopen("output.txt", "w", stdout);
  10.  
  11.     ios_base::sync_with_stdio(false);
  12.  
  13.     string str;
  14.     cin >> str;
  15.     int n = str.length();
  16.     int counter = 0;
  17.     for (int i = 0; i < n / 2; i++) {
  18.         if (str[i] != str[n - i - 1]) {
  19.             counter++;
  20.         }
  21.     }
  22.     if (counter != 0) {
  23.         counter -= 1;
  24.     }
  25.     cout << counter;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement