結果

問題 No.400 鏡
ユーザー ayaaya
提出日時 2019-07-30 14:12:25
言語 PHP
(8.3.4)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 715 bytes
コンパイル時間 1,128 ms
コンパイル使用メモリ 18,668 KB
実行使用メモリ 18,968 KB
最終ジャッジ日時 2023-09-17 21:22:31
合計ジャッジ時間 2,110 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
18,852 KB
testcase_01 AC 15 ms
18,968 KB
testcase_02 AC 15 ms
18,836 KB
testcase_03 AC 15 ms
18,916 KB
testcase_04 AC 15 ms
18,872 KB
testcase_05 AC 15 ms
18,900 KB
testcase_06 AC 15 ms
18,840 KB
testcase_07 AC 15 ms
18,696 KB
testcase_08 AC 15 ms
18,908 KB
testcase_09 AC 15 ms
18,840 KB
testcase_10 AC 15 ms
18,856 KB
testcase_11 AC 16 ms
18,908 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
/*

No.400 鏡
問題文
「<」と「>」からなる文字列がある。
鏡に映って左右反転した文字列はどうなっているだろうか?
(詳しくはサンプルを見てください。特にサンプル2を御覧ください。)

入力
S
Sは「<」と「>」からなる文字列。1≤Sの長さ≤20。

出力
鏡に映って反転した文字列を1行で答えよ。
最後に改行してください。

*/
$input=str_split(trim(fgets(STDIN)));
$length=count($input);
$mirror=array();
foreach($input as $key =>$value){
  if($value==">"){
    $mirror[$length-1-$key]="<";
  }else{
    $mirror[$length-1-$key]=">";
  }
}
for($i=0;$i<$length;$i++){
    echo $mirror[$i];
}


?>
0