Source Code:
#include <stdio.h>
typedef int unsigned ui;
void swi(char * ch) { // switch
*ch ^= 32;
}
int main (void) {
ui N;
char s[101];
char * ch;
scanf("%u", &N);
for (ui i = 1; i <= N; ++i) {
scanf("%s", s);
ch = s;
if (*ch < 'A' || *ch > 'Z') swi(ch);
++ch;
while(*ch != '\0') {
if (*ch < 'a' || *ch > 'z') swi(ch);
++ch;
}
printf("%s\n", s);
}
return 0;
}