| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 82 | 54 | 51 | 72.857% |
How many r's are there in the word strawberry? That's easy, it's obvious the answer is $3$. But to LLMs, the answer is not so obvious, and early models would count the word to have only $2$.
To further trick LLMs, you decide to take a string $s$, and repeat it $N$ times. Each time it's repeated, you change each letter to be the previous letter in the alphabet, with a instead becoming z. For example, the word abacus becomes zazbtr.
If we take the word strawberry and repeat it $3$ times in total, we get the string strawberryrsqzvadqqxqrpyuzcppw. This string contains $5$ occurrences of the letter r.
Given a word and the total number of times it is repeated, count the number of times r appears in it!
The first line of input contains a string $s$ of lowercase letters ($1 \le |s| \le 1000$).
The next line contains a single integer $N$ ($1 \le N \le 10^{15}$), the total number of times $s$ is repeated including the initial string, where each letter is replaced by the one before it in each repetition.
Output the number of times r appears in the final string.
strawberry 3
5
abacus 5
2
r 26
1
r 27
2
r 26000000000
1000000000
ICPC > Regionals > North America > Pacific Northwest Regional > 2025 ICPC Pacific Northwest Regional > Division 2 F번