Strawberry
면접 대비시간 제한1초메모리 제한2048 MB
문자열 s를 N번 반복하되 반복할 때마다 모든 글자를 알파벳에서 한 칸씩 앞으로 옮긴 최종 문자열에서 'r'이 몇 번 나오는지 센다.
문제
How many r's are there in the word strawberry? That's easy, it's obvious the answer is . But to LLMs, the answer is not so obvious, and early models would count the word to have only .
To further trick LLMs, you decide to take a string , and repeat it 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 times in total, we get the string strawberryrsqzvadqqxqrpyuzcppw. This string contains 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 of lowercase letters ().
The next line contains a single integer (), the total number of times 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.