#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
static void reverse_print(char *string);
static void cipher(char *string);
int main(void)
{
char string[BUFSIZ];
printf("Enter string: \n");
fgets(string, BUFSIZ, stdin);
string[strlen(string) - 1] = '\0';
reverse_print(string);
cipher(string);
printf("after cipher string = %s\n", string);
exit(0);
}
static void reverse_print(char *string)
{
int i;
for (i = strlen(string) - 1; i >= 0; i--)
{
putchar(string[i]);
}
putchar('\n');
}
static void cipher(char *string)
{
while (*string)
{
if (isalpha(*string))
{
if (*string >= 'T' && *string <= 'Z')
{
*string = 'A' + (*string - 'T');
}
else if (*string >= 't' && *string <= 'z')
{
*string = 'a' + (*string - 't');
}
else
{
*string += 7;
}
}
string++;
}
}