루미 알고리즘

#1589실버Kiki Boba

PO 2024 온라인 예선코딩출제 Harry Zhang영어 원문이 문제가 어렵다면 — 배우는 순서 보기

영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)

Problem

“Kiki” and “boba” form a fascinating sound-symbolic connection, where people spontaneously associate sharp sounds like “kiki” with jagged shapes and softer sounds like “boba” with rounder shapes. This reveals an underlying link between sounds and visual properties, providing insight into how our brains intuitively create meaning and associations.

Fergus has long held a keen interest in phonetics, and based on this sound-symbolic connection, he has developed a theory! He believes that all words can be categorized into 4 categories. In other words, each word is either a word corresponding to the figure on the left, like “kiki”, or a word corresponding to the figure on the right, like “boba”, or a word that is a combination of both, or a word that is none of the aforementioned alternatives.

(그림은 원문 저장소에서 볼 수 있습니다)

Figure 1: Figure to the left is commonly associated with "kiki". Figure to the right is commonly associated with "boba".

Fergus determines that a word belongs to a category according to the following rules: If there are more “b” than “k” in the word, then the word is a “boba” word. If there are more “k” than “b” in the word, then the word is a “kiki” word. If the word contains an equal number of “b” and “k”, then Fergus calls it a “boki” word. These rules hold with one exception: If there are no “b” and “k” in the word, the word is neither close to a “boba” word nor a “kiki” word. In this case, Fergus refers to the word as a “none” word.

Help Fergus write a program that, given a word, can categorize the word according to Fergus' rules.

Input

The only line of the input contains a string consisting of characters “a”-“z”, the word that Fergus wants to categorize.

Output

Print a category: either “boba”, “kiki”, “boki” or “none”, according to Fergus' rules stated above. There is always one category that fits each word.

Points

Your solution will be tested on several test case groups. To get the points for a group, it must pass all the test cases in the group.

GroupPoint valueConstraints
120The word is only one character long.
250The word has atleast one of either “k” or “b”, but never both at the same time.
330No additional constraints.

Explanation of sample 1

The word contains 2 “b”, while there are none of “k”. In other words there are more of “b” than “k”, which means that the answer is “boba”.

Explanation of sample 3

The word contains 1 “b” and 1 “k”. There are an equal number of “b” and “k”, which means the answer is “boki”.

예제

예제 1

입력
boba
출력
boba

예제 2

입력
kiki
출력
kiki

예제 3

입력
kobra
출력
boki

예제 4

입력
ljus
출력
none

출처 표기

출처: Programmeringsolympiaden 2024년 온라인 예선 · 원문 페이지 · 이용 조건 CC BY-SA · LaTeX 원문을 화면용 글로 옮겼습니다(수식·표의 모양이 다를 수 있습니다). 내용은 고치지 않았습니다.

크리에이티브 커먼즈 저작자표시-동일조건변경허락.

문제 출처: 한국정보올림피아드(KOI) (CC BY-NC-SA 4.0) · International Olympiad in Informatics (IOI) (CC BY) · Centre for Education in Mathematics and Computing (CEMC), University of Waterloo (CC BY-NC 4.0) · Programmeringsolympiaden (CC BY-SA) · CSES Problem Set (Antti Laaksonen) (CC BY-NC-SA 4.0). 루미 알고리즘은 위 단체들과 관계없는 별도의 서비스이며, 자료는 원문 그대로 싣습니다. 문제마다 출처와 이용 조건을 따로 표기합니다.