#include <iostream> #include <cstring> using namespace std; int main(){ char a[255]; cin >> a; int len = strlen(a); int s = 0,count = 0; while(true){ if(a[len/2-s-1]==a[len/2+s]){ count++; s++; } else break; } cout << count << endl; return 0; } Degree of symmetry
The degree of symmetry of a natural number is the number of pairs of its decimal digits, in which the digits match and are located symmetrically about the middle of the decimal notation of this number. If a certain number is in the middle of the decimal notation, it must also be taken into account together with it. Find the degree of symmetry of the number n.
Input data
One positive integer
n (n < 2 ·10^9).Output
Derive the degree of symmetry of the number
n. As a result, three correct answers out of 10.