Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
457 B
10
Indexable
Never
#include<stdio.h>
#include<string.h>
int kt(char *s)
{
	int i;
	int j;
	int n= strlen(s);
	j = n-1;
	int count = 0;
	for(i = 0;i<j;i++)
	{
		if(s[i] != s[j])
		{
			count++;
		}
		j--;
	}
	if(count == 1)
	{
		return 1;
	}
	return 0;
}
int main()
{
	int t;
	scanf("%d", &t);
	while(t--)
	{
		char s[21];
		scanf("%s", &s);
		if(kt(s) == 1)
		{
			printf("YES\n");
		}
		else
		{
			printf("NO\n");
		}
	}
	return 0;
}