結果

問題 No.163 cAPSlOCK
ユーザー 濱田孝治
提出日時 2020-08-06 16:17:05
言語 TypeScript
(5.7.2)
結果
AC  
実行時間 62 ms / 5,000 ms
コード長 784 bytes
コンパイル時間 7,642 ms
コンパイル使用メモリ 228,600 KB
実行使用メモリ 39,552 KB
最終ジャッジ日時 2024-12-31 16:17:08
合計ジャッジ時間 9,922 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import { stringify } from "querystring";

function isUpperCase(input: string): boolean {
  if (input == input.toUpperCase()) {
    return true
  } else {
    return false;
  }
}

function Main(input: any) {
  // inputにはすべての入力の文字列が与えられるので必要に応じて input.split("\n") などで分割する。
  const data = input.split("\n");
  const first_line = data[0].split(" ");
  const S: string = first_line[0];
  let answer: string = "";

  for (let i: number = 0; i < S.length; i++) {

    if (isUpperCase(S.substr(i, 1))) {
      answer += S.substr(i, 1).toLowerCase();
    } else {
      answer += S.substr(i, 1).toUpperCase();
    }
  }
  console.log(answer);
}
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0