#include<stdio.h>

#define ALPHABET 26

int main ()

{

char string[ALPHABET] = “abcdefghijkmnlopqrstuvwxyz”;

char perm [ALPHABET];

int i;

int distance;

int flag=1;

printf(“Enter ABC permutation\n”);

for(i=0;i<ALPHABET;i++)

{

scanf("%c",& perm[i]);

}

```
distance = (int)perm[0] - (int)string;
for(i=0;i<ALPHABET;i++)
{
if ( ((int)perm[i] - (int)string[i]) != distance )
{
flag = 0;
break;
}
}
if (flag)
{
printf("your input is invalid permutation\n");
}
else
{
printf("your input is valid permutation\n");
}
return 0;
}
```

Hi guys I need to write a code which has to check if a certain order of alphabetic letters is a permutation of the alphabetic letters in normal order.My problem is that I dont know how to print an error massage for wrong permutations like if I enter similar letters at least two times then its not a permutation.

Another example is when there is at least one capital letter or one number in the array perm[ALPHABET] then it has to print the error massage"your input is invalid permutation" so how do I do it in my code?

the idea for a valid input is this for example:

input :- abcdfehgikjmnlpoqsrtvuxwzy is a permutation of the whole 26 letters.

while inputs like writing the letter q 26 times or Abcdefghijkmnlopqrstuvwxyz or 1bcdefg6ijkmnlopqrstuvwxyz is wrong.