CodeDrill
day_streak: --
← 問題一覧に戻る
Python ・ Standard I/O

Problem 21: Reverse a String

A string S is given on one line from standard input. Print the string with S's characters arranged in reverse order, on one line.

For example, if S is hello, the answer is olleh.

Constraints

1 ≤ length of S ≤ 100 (S consists only of lowercase English letters)

Input example 1

hello

Output example 1

olleh

Input example 2

abc

Output example 2

cba

What you'll train

Cover the edge cases

What you get

  • Write how to handle an empty string
  • Write how to handle a single character
  • Make the reversal process explicit

How to ask the AI

Tell the AI how the output should look when the input is an empty string or just a single character. In addition to a concrete example like "S=hello gives olleh," it helps to clarify that the empty case should be handled by the same process.

If you ask vaguelyWhen you pass an empty string or a single-character input, the AI may add unnecessary error handling or special-case logic on its own.

あなたのコード

実行しました

プレビュー

AIレビュー(プロンプト練習)

コードはChatGPTやClaudeに出させたものを貼って構いません。
ここでの本番は「次にAIへ出す指示」です。評価軸は1つだけ見て、弱点・指示の穴・改善例を返します。
テストに落ちていてもレビューできます。落ちた理由と、指示に足りなかった情報を結びつけます。

先にコードを実行し、テストを1つ以上通してください。