Given a string, Write recursive function that reverses thestring.
Input Format
A String.
Constraints
x
Output Format
Reverse of Strings.
Sample Input
Being
Sample Output
gnieB
void reverseRecursively(char* s, int i, int j)
{
//code your logic here.
}
int main() {
char str[1000];
// To Read, Space Separated String
fgets(str, 1000, stdin);
// Remove ‘n’ from String
int len = strlen(str);
if(str[len-1]==’n’){
str[len-1]=’ ‘;
len–;
}
reverseRecursively(str, 0, len-1);
printf(“%s”, str);
return 0;
}
must be in java
Expert Answer
An answer will be send to you shortly. . . . .