A string S consisting only of lowercase English letters is given on one line. Replace each run of the same consecutive character with "character + number of consecutive occurrences" and output the result.
For example, aaabcc becomes a3b1c2.
Constraints
1 ≤ length of S ≤ 1000
Input example 1
aaabccOutput example 1
a3b1c2Input example 2
zOutput example 2
z1What you'll train
Specify the output
What you get
How to ask the AI
Clearly tell the AI that the output format concatenates each character and its count directly, as in "aaabcc" → "a3b1c2". It also helps to clarify how digits should be written when the count reaches 10 or more.
If you ask vaguelyThe AI tends to insert delimiters or spaces around the counts, or mishandle the digit representation when the run length is two digits.
あなたのコード
プレビュー
AIレビュー(プロンプト練習)
コードはChatGPTやClaudeに出させたものを貼って構いません。
ここでの本番は「次にAIへ出す指示」です。評価軸は1つだけ見て、弱点・指示の穴・改善例を返します。
テストに落ちていてもレビューできます。落ちた理由と、指示に足りなかった情報を結びつけます。