백준 12518번: Centauri Prime (Small2) #Python

ColorlessDia·2024년 12월 6일

algorithm/baekjoon

목록 보기
383/807
import sys

T = int(sys.stdin.readline())

for t in range(1, T + 1):
    country = sys.stdin.readline().rstrip()

    last_char = country[-1].lower()

    ruler = ''

    if last_char == 'y':
        ruler = 'nobody'
    elif last_char in 'aeiou':
        ruler = 'a queen'
    else:
        ruler = 'a king'

    print(f'Case #{t}: {country} is ruled by {ruler}.')

0개의 댓글