結果
| 問題 | No.163 cAPSlOCK |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-26 10:22:08 |
| 言語 | PHP (843.2) |
| 結果 |
AC
|
| 実行時間 | 42 ms / 5,000 ms |
| コード長 | 561 bytes |
| コンパイル時間 | 791 ms |
| コンパイル使用メモリ | 31,036 KB |
| 実行使用メモリ | 31,132 KB |
| 最終ジャッジ日時 | 2024-06-28 04:04:45 |
| 合計ジャッジ時間 | 2,583 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php
/**
* No.163 cAPSlOCK
*
* @see https://yukicoder.me/problems/339
*/
$expectedPasswordChars = str_split(trim(fgets(STDIN)));
$passwprdOnCapsLockChars = [];
while(count($expectedPasswordChars)) {
$hasReplaced = false;
$char = array_shift($expectedPasswordChars);
$replacedChar = strtolower($char);
if ($replacedChar != $char) {
$hasReplaced = true;
}
if(!$hasReplaced) {
$replacedChar = strtoupper($char);
}
$passwprdOnCapsLockChars[] = $replacedChar;
}
echo implode($passwprdOnCapsLockChars) . "\n";