結果
問題 |
No.1217 せしすせそ
|
ユーザー |
![]() |
提出日時 | 2020-10-14 20:29:41 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 99 ms / 2,000 ms |
コード長 | 377 bytes |
コンパイル時間 | 43 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 12,288 KB |
最終ジャッジ日時 | 2024-07-20 19:21:09 |
合計ジャッジ時間 | 1,879 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
コンパイルメッセージ
Syntax OK
ソースコード
def calc(input) original = ("a".."z").to_a a = original.difference(input.chars).first b = input.chars.select { |it| input.chars.count(it) > 1 }.first "#{a}to#{b}" end def calc2(input) input.chars.zip(("a".."z")).select { |a, b| a != b }.first.then { |a, b| "#{b}to#{a}" } end # input = "abcdefghijklmnnpqrstuvwxyz" input = gets # puts calc(input) puts calc2(input)