Skip to content

Instantly share code, notes, and snippets.

Created October 14, 2012 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/3888140 to your computer and use it in GitHub Desktop.
Save anonymous/3888140 to your computer and use it in GitHub Desktop.
#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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment