結果

問題 No.163 cAPSlOCK
ユーザー maimai8
提出日時 2020-08-05 11:33:22
言語 OCaml
(5.2.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 473 bytes
コンパイル時間 401 ms
コンパイル使用メモリ 21,440 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-09 01:55:09
合計ジャッジ時間 1,406 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

let () =
  let rec charlist_of_string str n i =
    if i = n then [] else str.[i] :: charlist_of_string str n (i+1) in
  let rec convert lst = match lst with
    | [] -> ""
    | h :: t ->
      if h = Char.lowercase_ascii h then (Char.escaped (Char.uppercase_ascii h)) ^ convert t
      else (Char.escaped (Char.lowercase_ascii h)) ^ convert t in
  Scanf.scanf "%s\n" @@ fun s ->
  let lst = charlist_of_string s (String.length s) 0 in
  Printf.printf "%s\n" (convert lst)
0