바킹독 알고리즘 문제집 - 연결 리스트
·
알고리즘/Algorithm
1406번 : 에디터 - silver 2 #include #include #include using namespace std; int main(void){ string str; cin>>str; list l; for(auto s:str) l.push_back(s); // list에 문자 순서대로 넣기 auto now = l.end(); // list::iterator cur = l.end() int q; cin>>q; while(q--){ // q만큼 돈다 char c; cin>>c; if(c=='P'){ // 왼쪽에 문자 추가 char w; cin>>w; l.insert(now, w); // 왼쪽 위치에 w 추가 }else if(c=='L'){ if(now!=l.begin()) now--; // 왼쪽으..