#include <iostream>
#include <string>

std::string reverse(std::string &str, int start, int end){
    if(start>=end){
        return str;
    }
    
    int tmp = str[start];
    str[start] = str[end];
    str[end] = tmp;
    
    return reverse(str,start+1,end-1);
}

int main() {
    std::string str = "Adarsha";
    int size = str.size();
    std::string s = reverse(str, 0 ,size-1);
    std::cout<<s;
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: