Skip to content

Comments

upload: ch09 1406 codes(cpp, py)#18

Draft
Eucha09 wants to merge 1 commit intomainfrom
ch09-eucha
Draft

upload: ch09 1406 codes(cpp, py)#18
Eucha09 wants to merge 1 commit intomainfrom
ch09-eucha

Conversation

@Eucha09
Copy link
Collaborator

@Eucha09 Eucha09 commented Aug 7, 2023

No description provided.

@Eucha09 Eucha09 requested a review from gbe0808 August 7, 2023 03:41
@Eucha09 Eucha09 marked this pull request as draft August 7, 2023 04:58
Comment on lines +8 to +21
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
while M > 0:
cmd = input().rstrip()
if cmd[0] == 'L':
if left_lst:
right_lst.append(left_lst.pop())
elif cmd[0] == 'D':
if right_lst:
left_lst.append(right_lst.pop())
elif cmd[0] == 'B':
if left_lst:
left_lst.pop()
elif cmd[0] == 'P':
left_lst.append(cmd[2])
M -= 1
for _ in range(M):
cmd = input().rstrip()
if cmd[0] == 'L':
if left_lst:
right_lst.append(left_lst.pop())
elif cmd[0] == 'D':
if right_lst:
left_lst.append(right_lst.pop())
elif cmd[0] == 'B':
if left_lst:
left_lst.pop()
elif cmd[0] == 'P':
left_lst.append(cmd[2])

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
int main(void)
int main()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants