public
anonymous / gist:3888140
Created

  • Download Gist
gistfile1.cpp
C++
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#include <iostream>
#include <string>
#include <deque>
using namespace std;
 
int main()
{
const string str = "Hello world";
const int len = str.length();
string s = "";
deque<char> temp;
 
for (int i = 0; i < len; i++)
temp.push_front(str[i]);
 
for (int i = 0; i < len; i++)
s += temp[i];
 
cout << "Original: " << str << endl;
cout << "Reversed: " << s << endl;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.