Untitled
unknown
c_cpp
2 years ago
307 B
6
Indexable
#include <iostream>
#include <math.h>
using namespace std;
string reverse(string a) {
string b = a;
int c = 0;
for (int i = a.length() - 1; i >= 0; i--)
{
b[c] = a[i];
c++;
}
return b;
}
int main() {
setlocale(LC_ALL, "Russian");
string a;
cin >> a;
cout << reverse(a);
}Editor is loading...
Leave a Comment