44 lines
826 B
C
44 lines
826 B
C
|
#include <stdio.h>
|
||
|
|
||
|
// Function prototypes
|
||
|
int get_length(int n);
|
||
|
int get_last(int n, int loc);
|
||
|
|
||
|
int main(void) {
|
||
|
// Initialize variables
|
||
|
int n;
|
||
|
scanf("%d", &n);
|
||
|
|
||
|
int len = get_length(n);
|
||
|
/* printf("%i\n", len); */
|
||
|
for (int i = 1; i <= len / 2; i++) {
|
||
|
if (get_last(n, len - i + 1) != get_last(n, i)) {
|
||
|
/* printf("the number at %i is %i\n", i, get_last(n, i)); */
|
||
|
/* printf("the number at %i is %i\n", len - i, get_last(n, len - i + 1)); */
|
||
|
printf("No\n");
|
||
|
return 0;
|
||
|
}
|
||
|
}
|
||
|
printf("Yes\n");
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
int get_length(int n) {
|
||
|
int len = 0;
|
||
|
if (n == 0) { // 0 should have the same digits as 1 - 9
|
||
|
n = 9;
|
||
|
}
|
||
|
while (n > 0) {
|
||
|
n /= 10;
|
||
|
len++;
|
||
|
}
|
||
|
return len;
|
||
|
}
|
||
|
|
||
|
int get_last(int n, int loc) {
|
||
|
for (int i = 1; i < loc; i++) {
|
||
|
n /= 10;
|
||
|
}
|
||
|
return n % 10;
|
||
|
}
|