본문 바로가기
python-algorithm

백준 7656 만능 오라클

by 무적김두칠 2023. 12. 6.

https://www.acmicpc.net/problem/7656

 

7656번: 만능 오라클

입력은 한 줄로 된 1000자 이내의 단락이 주어진다. 포함된 문자는 대소문자, 띄어쓰기, 하이픈(hyphen), 어퍼스트로피(apostrophe), 반점(comma), 세미콜론(semicolon), 온점(period)과 물음표(question mark)이다.

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
def sol(s):
    start = end = -1
    while s.find('What', end + 1!= -1:
        start = s.find('What', end + 1)
        end = s.find('?', start + 1)
        new_s = s[start:end]
        if new_s.find('.'!= -1:
            end = s.find('.', start + 1)
            continue
        print('Forty-two' + new_s[4:] + '.')
 
= input()
sol(s)
 
cs
반응형

'python-algorithm' 카테고리의 다른 글

백준 17091 단어 시계  (0) 2023.12.06
백준 9324 진짜 메시지  (1) 2023.12.06
백준 30868 개표  (0) 2023.12.04
백준 5949 Adding Commas  (1) 2023.11.29
백준 8892 팰린드롬  (1) 2023.11.29

댓글