結果

問題 No.729 文字swap
ユーザー GBGB
提出日時 2018-09-20 20:07:01
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 440 ms
コンパイル使用メモリ 65,548 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 08:36:33
合計ジャッジ時間 971 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>

using namespace std;

int main() {
	
	string str;
	int i, j;
	cin >> str;
	cin >> i >> j;
	string ch1 = str.substr(i,1);
	string ch2 = str.substr(j,1);
	str.replace(i,1,ch2);
	str.replace(j,1,ch1);

	cout << str << endl;

	return 0;
}
0