Counting characters (chat)
Statement
One Korean word comes in. You have to count its characters and print the count as an integer.
| Input word | Expected output |
|---|---|
| 안녕하세요 | 5 |
안녕하세요 is five characters, so 5 is the answer. For a person this is over as soon as they look at it.
Input
The input arrives as one line.
The input is between 1 and 5 characters long.
Output
On the first line, print one of
1,2,3,4,5.Do not add any other characters.
Not a single character may differ from the expected value.
Requirements
- The input is a single Korean word.
- The output is the character count written as an integer.
- This is chat mode. The prompt is wrapped in a chat template, so the model becomes an assistant. You can write control tokens yourself to build a conversation of several turns.
- Only the last integer of the output is read. You may write the working before it.
- There are 16 cases, and 5 of them show the input together with the expected output. The rest show the input only.
- Model output is accepted up to 8 tokens.
- You have to pass all 16 cases to solve this.
Examples
The input data for this problem is in Korean. The expected output is not, so you can write your prompt in English. The example cases below show what the input looks like.
5 public cases. Judging also uses hidden cases. You have to pass all 16 cases to solve this.
안녕하세요
5
컴퓨터
3
대한민국
4
프로그래밍
5
책
1
Notes
Background that helps with solving. The rules you have to follow are in the input and output specs and the requirements above.
You often hear that language models cannot count characters. A word arrives as two or three tokens, so the individual characters were never represented on their own in the first place. Pushing harder with the instruction does not help. Before it counts, you have to build a state in the context where the characters each exist on their own.
Only the last integer is graded, so you can let it write out the working.