<jupyter_start><jupyter_text>2020년 5월 8일 금요일 BaekJoon - 1406번 : 에디터 문제 : https://www.acmicpc.net/problem/1406 블로그 : https://somjang.tistory.com/entry/BaekJoon-1406%EB%B2%88-%EC%97%90%EB%94%94%ED%84%B0-Python  첫번째 시도<jupyter_code>import sys 
from collections import deque 

class Editor: 
    def __init__(self, input_text): 
        self.left_deque = deque(input_text) 
        self.right_deque = deque() 

    def move_cursor_left(self): 
        if self.left_deque: 
            self.right_deque.appendleft(self.left_deque.pop()) 

    def move_cursor_right(self): 
        if self.right_deque:
            self.left_deque.append(self.right_deque.popleft()) 

    def delete_left_character(self): 
        if self.left_deque: 
            self.left_deque.pop() 

    def add_character_to_left(self, character2add): 
        self.left_deque.append(character2add) 

editor = Editor(sys.stdin.readline().strip()) 
            
N = int(sys.stdin.readline().strip()) 
            
while N: 
    command = sys.stdin.readline().strip() 
    if command[0] == 'L': 
        editor.move_cursor_left() 
    elif command[0] == 'D': 
        editor.move_cursor_right() 
    elif command[0] == 'B': 
        editor.delete_left_character() 
    else: 
        editor.add_character_to_left(command[2]) 
    N -= 1 
print(''.join(editor.left_deque) + ''.join(editor.right_deque))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12984218077474893, 'fraction_numerical': 0.027977044476327116, 'mean_word_length': 2.885793871866295, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '631109', 'license': 'MIT', 'n_tokens_mistral': 561, 'n_tokens_neox': 530, 'n_words': 72, 'path': 'DAY 001 ~ 100/DAY092_[BaekJoon] 에디터 (Python).ipynb', 'repo_name': 'SOMJANG/CODINGTEST_PRACTICE', 'size': '1394'}