C. reverse string

Naive

时间限制:2000 ms

内存限制:512 MiB

题面

Write a recursive version of the function reverse(s), which reverses the string ss in place.

Write a program to enter a string and call reverse(s).

See also Exercise 4-13 in the textbook

#include <stdio.h>
#include <string.h>

/***************************************************************/
/*                                                             */
/*  DON'T MODIFY main function ANYWAY!                         */
/*                                                             */
/***************************************************************/

void reverse(char s[]) {
    // TODO: your function definition
}

#define MAXLINE 80  /* maximum input line length */

int main() {
    char s[MAXLINE];
    scanf("%s", s);
    //********** reverse is called here *************
    reverse(s);
    //**************************************************
    printf("%s", s);
}

样例

输入

ecnu

输出

unce