//ReverseCaseAndString
#include<stdio.h>
#include<string.h>
void changeCaseAndReverse(char *str){
int i, len, temp;
len = strlen(str);
for (i=0; i<len/2;i++){
temp = str[i];
str[i] = str[len-i-1];
str[len-i-1] = temp;
}
int ll = strlen(str);
for (int i=0; i<ll; i++){
if(str[i]>='a' && str[i]<='z')
str[i]= str[i]-32;
else if(str[i]>='A' && str[i]<='Z')
str[i] = str[i]+32;
}
}
int main(){
char str[50]="abcdFRTY";
int i;
printf("\n Enter a string to be reversed and cased: ");
//gets(str);
changeCaseAndReverse(str);
for(i=0;i<strlen(str);i++){
printf("%c", str[i]);}
return 0;
}
Ly9SZXZlcnNlQ2FzZUFuZFN0cmluZwojaW5jbHVkZTxzdGRpby5oPgojaW5jbHVkZTxzdHJpbmcuaD4Kdm9pZCBjaGFuZ2VDYXNlQW5kUmV2ZXJzZShjaGFyICpzdHIpewogICAgaW50IGksIGxlbiwgdGVtcDsKICAgIGxlbiA9IHN0cmxlbihzdHIpOwogICAgZm9yIChpPTA7IGk8bGVuLzI7aSsrKXsKICAgICAgICB0ZW1wID0gc3RyW2ldOwogICAgICAgIHN0cltpXSA9IHN0cltsZW4taS0xXTsKICAgICAgICBzdHJbbGVuLWktMV0gPSB0ZW1wOwogICAgfQogICAgaW50IGxsID0gc3RybGVuKHN0cik7CiAgICBmb3IgKGludCBpPTA7IGk8bGw7IGkrKyl7CiAgICAgICAgaWYoc3RyW2ldPj0nYScgJiYgc3RyW2ldPD0neicpCiAgICAgICAgICAgIHN0cltpXT0gc3RyW2ldLTMyOwogICAgICAgIGVsc2UgaWYoc3RyW2ldPj0nQScgJiYgc3RyW2ldPD0nWicpCiAgICAgICAgICAgIHN0cltpXSA9IHN0cltpXSszMjsKICAgIH0KCn0KCmludCBtYWluKCl7CiAgICBjaGFyIHN0cls1MF09ImFiY2RGUlRZIjsKICAgIGludCBpOwogICAgcHJpbnRmKCJcbiBFbnRlciBhIHN0cmluZyB0byBiZSByZXZlcnNlZCBhbmQgY2FzZWQ6ICIpOwogICAgLy9nZXRzKHN0cik7CiAgICBjaGFuZ2VDYXNlQW5kUmV2ZXJzZShzdHIpOwogICAgZm9yKGk9MDtpPHN0cmxlbihzdHIpO2krKyl7CiAgICBwcmludGYoIiVjIiwgc3RyW2ldKTt9CiAgICByZXR1cm4gMDsKfQo=