#include<stdio.h>
#include<math.h>
int main()
{

int i,j,n,k,l,t,a,h=1,b,w,g,x,u;
scanf("%d",&x);
for(u=1;u<=x;u++)

{

scanf("%d",&g);
w=1;

for(k=g+1;w;k++)
 {

     h=k;


  for(l=0;h>0;l++)
    {h=h/10;

    }
    t=k;
    for(i=l-1;i>=0;i--)
    {
        a=(t/pow(10,i));

        a=a%10;
        b=(t/pow(10,l-i-1));
        b=b%10;
        if(a==b)
        {


            continue;}
        else
        {


            break;}
    }
        if(i==-1)
           {

            printf("%d\n",k);
            w=0;}


}

}

 return 0;

}

Suggested Topics

Topic Category Replies Views Activity
C and C++ 0 36 28d

Want to read more? Browse other topics in C and C++ or view latest topics.