Have the function FirstReverse(str) take the str parameter being passed and return the string in reversed order.
For example: if the input string is "Hello World and Coders" then your program should return the string sredoC dna dlroW olleH.
Solution:
#include <iostream>
#include <string>
using namespace std;
string FirstReverse(string str) {
for(int i=0;i<str.size()/2;i++){
swap(str[i],str[str.size()-i-1]);
}
return str;
}
int main(void) {
cout << FirstReverse(coderbyteInternalStdinFunction(stdin));
return 0;
}