-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
문자열 폭발-최규호 #21
base: master
Are you sure you want to change the base?
문자열 폭발-최규호 #21
Conversation
for c in string: | ||
stack.append(c) #스택 삽입 | ||
if c == last and ''.join(stack[-b_length:]) == bomb: | ||
#입력 받은 문자열에서 c == 폭발 문자열의 마지막 문자('4') | ||
#스택의 끝부터 폭발 문자열의 길이만큼의 문자열 == 폭발 문자열 | ||
#(ex) ''.join(stack[-2:]) == bomb | ||
del stack[-b_length:] | ||
#스택의 끝부터 폭발 문자열의 길이만큼의 문자열 삭제 | ||
|
||
answer=''.join(stack) | ||
#스택의 남은 문자열 합치기 | ||
|
||
if answer == '': #stack이 비어있으면 | ||
print("FRULA") | ||
else: | ||
print(answer) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
정확히 이해했다면 문제 없는 것 같아
string = input() #입력 받은 문자열 (ex) mirkovC4nizCC44 | ||
bomb=input() #폭발 문자열 (ex) C4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
입력받는 속도를 줄이기 위해 sys.stdin.readline().rstrip()에 대해 공부하면 좋을 것 같아:]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넵!
맨 밑 부분에 작성한 과정으로 코드가 실행되는게 맞는지 확인해주세요 : )