next palindrome number in cpp
#include <iostream>
#include <string.h>
using namespace std;
int nextpalin (int num){
while (num++) {
string str = to_string (num); /// int to string conversion
int l = str.length()-1;
int s = 0;
while( s<l ){
if (str[s]!=str[l]) break;
else {
s++;
l--;
}
if (s>=l) return num;}
}
}
int main () {
int t;
cin >> t;
while (t--){
int num;
cin >> num;
if (num==0) cout << "1" << endl;
else {
if (num<9) cout << num+1 << endl;
else cout << nextpalin( num) << endl;}
}
}