분류 전체보기
-
5397) 키로거 c++백준코딩일기 2020. 11. 5. 13:46
문제 ) www.acmicpc.net/problem/5397 5397번: 키로거 첫째 줄에 테스트 케이스의 개수가 주어진다. 각 테스트 케이스는 한줄로 이루어져 있고, 강산이가 입력한 순서대로 길이가 L인 문자열이 주어진다. (1 ≤ L의 길이 ≤ 1,000,000) 강산이가 백스페이 www.acmicpc.net 풀이 ) ltr = ans.end() 로 지정하여 ans의 오른쪽을 가리키게 설정한다. 입력받은 문자열만큼 반복해서 확인을 하는데, 1.'' 문자가 들어왔을 경우 커서를 오른쪽으로 움직여야하므로 itr = ans.end() 라면 커서는 글자 뒤 즉, 오른편에 있지만, 아니라면 itr++ 3. '-' 문자가 들어왔을 경우 현재 커서위치 앞에 글자가 존재하면 그 글자를 삭제한다. itr = ans...