[C++] 백준 5397 키로거
·
Algorithm/Baekjoon
#include #include #include using namespace std; int main() { int n; string temp; cin >> n; for (int i = 0; i > temp; stack left;//커서의 좌측 stack right;//커서의 우측//우측은 읽는 순서가 반대 pop해야됨 for (int j = 0; j < temp.length(); j++) { if (temp[j] == '') { if (!right.empty()) { left.push(right.top());//오른쪽의 첫번째 값을 왼쪽에 넣는다. right.pop(); } } else if (temp[j] == '-') { if (!left.empty()) left.po..