Skip to content

Instantly share code, notes, and snippets.

@hhc0null
Created January 20, 2012 13:46
Show Gist options
  • Save hhc0null/1647441 to your computer and use it in GitHub Desktop.
Save hhc0null/1647441 to your computer and use it in GitHub Desktop.
aoj-0006-Reverse_Sequence.cpp
/*
both my legs itch...
help...
by the way, is my english sure?
*/
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <stack>
using namespace std;
int main() {
char buff; // buffer of char type
stack<char> ch_stck; // stack of char type
for(;cin >> buff;) {
ch_stck.push(buff); // push a character into stack
}
for(;!ch_stck.empty();) {
cout << ch_stck.top() << flush; // output characters from stack (from top to bottom)
ch_stck.pop(); // pop the top of stack
}
cout << endl; // output LF
return 0;
}
@yutopp
Copy link

yutopp commented Jan 20, 2012

include

include

include

int main() {
std::string s;
std::cin >> s;
std::copy( s.rbegin(), s.rend(), std::ostream_iterator( std::cout, "" ) );
}

こういうことですか?

@yutopp
Copy link

yutopp commented Jan 20, 2012

include

include

include

最初が消えました;

@hhc0null
Copy link
Author

いろいろやってみましたが, そのコード動きませんでした… > yutopp

@yutopp
Copy link

yutopp commented Jan 21, 2012

すみません;
std::copy( s.rbegin(), s.rend(), std::ostream_iterator( std::cout, "" ) );

std::copy( s.rbegin(), s.rend(), std::ostream_iterator( std::cout, "" ) );
ですね。

gistさんがわざわざ綺麗に<>を消してくれていました。

@hhc0null
Copy link
Author

把握です
ありがとうございます♪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment