# Even length Palindromic Number

**program:-**

You have to design a new model which maps an even length palindromic number to some digit between 0 to 9.

The number is mapped to a digit

Explanation

For case 1:

1st even length palidromic number is 11 , so answer is 1 as 1 appears most number of times in the number.

For case 2:

2nd even length palidromic number is 22 , so answer is 2 as 2 appears most number of times in the number.

For case 3:

10th even length palindromic number is 1001, here both 0 and 1 appears same number of times but 0<1 so answer is 0.

1st even length palidromic number is 11 , so answer is 1 as 1 appears most number of times in the number.

For case 2:

2nd even length palidromic number is 22 , so answer is 2 as 2 appears most number of times in the number.

For case 3:

10th even length palindromic number is 1001, here both 0 and 1 appears same number of times but 0<1 so answer is 0.

Time Limit:1.0 sec(s) for each input file.

Memory Limit:256 MB

## solution:-

#include<stdio.h>

void main()

{

int t,k=0,a[10],max,r;

long long int n;

scanf(“%d”,&t);

for(int i=0;i<t;i++)

{

for(int j=0;j<=9;j++)

a[j]=0;

scanf(“%lld”,&n);

while(n!=0)

{

r=n%10;

a[r]++;

n=n/10;

}

max=a[0];

for(int j=0;j<=9;j++)

{

if(max<a[j])

{

max=a[j];

k=j;

}

}

printf(“%dn”,k);

}