#include <iostream>
#include <string.h>
#define SIZE 256
void reverse(char *str);
int main(int argc, char *argv[]) {
char str[SIZE];
std::cin.getline(str, SIZE);
reverse(str);
std::cout << str << std::endl;
return 0;
}
void reverse(char *str) {
size_t length = strlen(str) - 1;
for (size_t i = 0; i < strlen(str) / 2; i++) {
char temp = str[i];
str[i] = str[length];
str[length] = temp;
length--;
}
}
Comments
Leave a comment