結果

問題 No.729 文字swap
ユーザー dyechidyechi
提出日時 2019-03-28 15:40:56
言語 PHP
(8.3.4)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 3,970 ms
コンパイル使用メモリ 32,404 KB
実行使用メモリ 31,512 KB
最終ジャッジ日時 2024-04-21 04:44:35
合計ジャッジ時間 3,805 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
31,512 KB
testcase_01 AC 38 ms
31,256 KB
testcase_02 AC 35 ms
31,192 KB
testcase_03 AC 38 ms
31,180 KB
testcase_04 AC 37 ms
30,980 KB
testcase_05 AC 39 ms
31,336 KB
testcase_06 AC 38 ms
31,292 KB
testcase_07 AC 38 ms
31,268 KB
testcase_08 AC 38 ms
31,236 KB
testcase_09 AC 40 ms
31,120 KB
testcase_10 AC 39 ms
31,396 KB
testcase_11 AC 37 ms
31,160 KB
testcase_12 AC 40 ms
31,388 KB
testcase_13 AC 37 ms
31,116 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
while ($line = fgets(STDIN)) {
	$s[] = trim($line);
}
foreach ($s as $key => $value) {
	$array[] = explode(" ", $value);
}
$word = array_splice($array, 0, 1);
$word_arr = str_split($word[0][0]);

$first_letter = $word_arr[$array[0][0]];
$second_letter = $word_arr[$array[0][1]];

$word_arr[$array[0][0]] = $second_letter;
$word_arr[$array[0][1]] = $first_letter;

echo implode("", $word_arr).PHP_EOL;
?>
0