static int nextPalindrome(int a) {
		int tmp = a;
		int i;
		for (i = 0; tmp > 0; i++) {
			status[i] = tmp % 10;
			tmp /= 10;
		}
		i--;
		int middle = i / 2;
		int carry = 1;
		if (i % 2 == 0) {
			// odd number
			if (status[middle] < 9) {
				if (middle == 0) {
					status[middle] += 2;
				} else {
					status[middle]++;
				}
				carry = 0;
			} else {
				status[middle] = 0;
				carry = 1;
				if (middle == 0) {
					status[0] = 1;
					status[i + 1] = 1;
					i++;
					carry = 0;
					middle++;
				}
				middle--;
			}
		}
		while (carry == 1) {
			if (status[middle] == 9) {
				status[middle] = 0;
				status[i - middle] = 0;
				if (middle == 0) {
					status[0] = 1;
					status[i] = 0;
					status[i + 1] = 1;
					carry = 0;
					i++;
					middle++;
				}
			} else {
				if (middle == 0) {
					status[middle] += 2;
					status[i - middle] += 2;
				} else {
					status[middle]++;
					status[i - middle]++;
				}
				carry = 0;
			}
			middle--;
		}

		return arr2int(i);
	}