Log inSign up
Problems / P27

Count a given letter (chat)

400 ptschatqwen3-0.6bCases 16max 8 tokensSet by dongbinna
Added October 11.

Statement

Input arrives in the form word / letter. You have to print how many times that letter appears in that word as an integer. Only the last integer is graded.

Input lineExpected output
strawberry / r3

In strawberry the letter r appears three times, as st-r-awbe-rr-y. This is the spot where the model often writes 2, because it does not look at the characters one by one but at chunks of tokens. Making it lay them out as s t r a w b e r r y and count with a number on each is what starts getting it right. Only the last integer is graded, so the counting may be written out in front of it.

Input

  • The input arrives as one line.

  • The input is between 10 and 15 characters long.

Output

  • Print one of 2, 3 or 4 on the first line.

  • Do not add any other characters.

  • Not a single character may differ from the expected value.

Requirements

  • The input has the form strawberry / r.
  • The output is the number of occurrences 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.
Read the requirements carefully before solving. Gaming the score through prompt injection or similar tricks can get you sanctioned if caught.

Examples

5 public cases. Judging also uses hidden cases. You have to pass all 16 cases to solve this.

Input
Expected output
strawberry / r
3
banana / a
3
committee / m
2
parallel / l
3
mississippi / s
4

Prompt

Qwen3 0.6B
Input to preview
This is the exact text that goes into the model (Sample input 1 is used here.)
This problem wraps your text in a chat template, so the exact text can only be shown once the model is loaded. Load Qwen3 0.6B first with the button below.
0 chars
To solve problems you need to log in.