Revert String by Using Stack

Given a string, please use stack to revert the string.

Put all characters into stack , and then pop out them sequence by sequence.

string RevertString(string &str) {
	stack<char> st;
	string rs;

	for (auto &c: str) {
		st.push(c);
	}
	while (!stack_.empty()) {
		rs += st.top();
		st.pop();
	}
	return rs;
}