#include <iostream>
#include <string>
using namespace std;
string every_second(string s)
{
if (s.length() <= 1)
{
return s;
}
else
{
string simpler = every_second(s.substr(2)); // Get substring starting from the 3rd character
return s[0] + simpler;
}
}
int main()
{
string s = "Hello";
cout << every_second(s) << endl;
cout << "Expected: Hlo" << endl;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: