No.729 Character Swap
レベル :
/ AI推定難易度 : 101
/ 実行時間制限 : 1ケース 2.000秒 / メモリ制限
: 512 MB / 標準ジャッジ問題
タグ : / 解いたユーザー数 565
作問者 :
nmnmnmnmnmnmnm
/ テスター :
ciel
タグ : / 解いたユーザー数 565
作問者 :
nmnmnmnmnmnmnm
/ テスター :
問題文最終更新日: 2026-07-02 02:49:32
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
yukicoder contest 199
(順位表)
の他の問題:
Problem Statement
Given a string, swap its $i$-th and $j$-th characters.
Input
$S$ $i$ $j$
$S$ is a string consisting only of lowercase letters. $2 \le$ length of the string $S$ $\le 10$.
$i$ and $j$ represent the $i$-th and $j$-th positions (0-indexed) of the string $S$, respectively.
$i$ and $j$ are each non-negative integers. $0 \le i,j \le$ length of the string $S$ minus 1.
$i$ and $j$ are different.
Output
Print the answer on one line.
Print a newline at the end.
Sample
Sample 1
Input
abc 0 2
Output
cba
Swap the 0th and 2nd characters.
Sample 2
Input
yukicoder 6 2
Output
yudicoker
Swap the 6th and 2nd characters.
Sample 3
Input
samples 0 6
Output
samples
Sometimes swapping the characters results in the same string.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。