#define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i,p,n) for(int i=(int)p;i<(int)n;i++) #define repp(i,p,n) for(int i=(int)p;i>=(int)n;i--) #define Sort(x) sort(x.begin(),x.end()); #define ll long long #define vi vector #define vvi vector> #define vvvi >> #define vc vector #define vvc vector> #define vvvc vector>> #define INF 2000000000 using namespace std; int main() { string s; getline(cin, s); int count = 0; while (s.length() > 1) { if (s[0] == s[s.length() - 1] && s[0]!=' ') { count++; } s.erase(s.begin()); s.erase(s.end() -1); } if (s.length() == 1 && count!=0) cout << 2*count + 1 << endl; else cout << 2*count << endl; return 0; }