-
Notifications
You must be signed in to change notification settings - Fork 0
/
lexopal.c
51 lines (49 loc) · 873 Bytes
/
lexopal.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <stdio.h>
#include<string.h>
int main(void) {
// your code goes here
int t;
scanf("%d",&t);
while(t--)
{
char a[22222];
scanf("%s",a);
int i,len=strlen(a),flag=0;
for(i=0;i<len/2;i++)
{
if(a[i]!=a[len-i-1])
{
if(a[i]=='.')
{
a[i]=a[len-i-1];
}
else if(a[len-i-1]=='.')
{
a[len-i-1]=a[i];
}
else
flag++;
}
if(a[i]=='.'&& a[len-1-i]=='.')
{
a[i]='a';
a[len-1-i]='a';
}
}
if(len%2==1)
{
if(a[len/2]=='.')
{
a[len/2]='a';
}
}
if(flag==0)
{
printf("%s",a);
}
else
printf("-1");
printf("\n");
}
return 0;
}