#define _GNU_SOURCE #include #include void reverse(char* s) { const size_t l = strlen(s); int start = 0; int end = l - 1; char c; while (start < end) { c = s[start]; s[start] = s[end]; s[end] = c; start++; end--; } } void flip(char* s) { const size_t l = strlen(s); for (int i = 0 ; i < l ; i++) { switch (s[i]) { case '<': s[i] = '>'; break; case '>': s[i] = '<'; break; default: break; } } } void smash_newline(char* s) { const size_t l = strlen(s); for (int i = l-1 ; i > 0 ; i--) { switch(s[i]) { case '\r': s[i] = '\0'; break; case '\n': s[i] = '\0'; default: break; } } } int main(void) { char s[1025]; fgets(s, 1025, stdin); smash_newline(s); flip(s); reverse(s); puts(s); }