A string S is given on the first line, and a single character C is given on the second line. Print, on one line, how many times C appears in S.
For example, if S is banana and C is a, the answer is 3. If it doesn't appear at all, print 0.
Constraints
1 ≤ length of S ≤ 100 (S and C consist only of lowercase English letters)
Input example 1
banana
aOutput example 1
3Input example 2
hello
lOutput example 2
2What you'll train
Cover the edge cases
What you get
How to ask the AI
Tell the AI the condition that if C doesn't appear at all in S, it should output 0. It also helps to clarify, with concrete examples, whether uppercase and lowercase should be distinguished, reducing the chance of misunderstanding.
If you ask vaguelyIf the case where the count is 0 isn't considered, the AI may write code that returns an error or an empty string.
あなたのコード
プレビュー
AIレビュー(プロンプト練習)
コードはChatGPTやClaudeに出させたものを貼って構いません。
ここでの本番は「次にAIへ出す指示」です。評価軸は1つだけ見て、弱点・指示の穴・改善例を返します。
テストに落ちていてもレビューできます。落ちた理由と、指示に足りなかった情報を結びつけます。