結果

問題 No.163 cAPSlOCK
ユーザー michiru
提出日時 2019-11-08 11:40:20
言語 PHP
(843.2)
結果
AC  
実行時間 42 ms / 5,000 ms
コード長 314 bytes
コンパイル時間 2,840 ms
コンパイル使用メモリ 30,448 KB
実行使用メモリ 31,252 KB
最終ジャッジ日時 2024-09-15 00:48:58
合計ジャッジ時間 4,391 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$S = trim(fgets(STDIN));
$arr = str_split($S);

$ans = "";
$arr2 = []; //変換した文字列を入れる配列
foreach ($arr as $word) {
    if (ctype_upper($word)) {
        $arr2[] = strtolower($word);
    } else {
        $arr2[] = strtoupper($word);
    }
}

$ans = implode('', $arr2);

echo $ans."\n";
0