結果

問題 No.1362 [Zelkova 8th Tune] Black Sheep
ユーザー 👑 obakyanobakyan
提出日時 2021-01-22 21:34:45
言語 Lua
(LuaJit 2.1.1696795921)
結果
AC  
実行時間 8 ms / 1,000 ms
コード長 379 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 5,300 KB
実行使用メモリ 7,188 KB
最終ジャッジ日時 2023-08-27 17:45:19
合計ジャッジ時間 1,979 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 7 ms
7,004 KB
testcase_14 AC 7 ms
6,900 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 3 ms
4,380 KB
testcase_17 AC 7 ms
7,004 KB
testcase_18 AC 4 ms
4,484 KB
testcase_19 AC 7 ms
7,048 KB
testcase_20 AC 6 ms
6,696 KB
testcase_21 AC 4 ms
4,568 KB
testcase_22 AC 6 ms
6,900 KB
testcase_23 AC 7 ms
7,160 KB
testcase_24 AC 7 ms
7,092 KB
testcase_25 AC 7 ms
7,148 KB
testcase_26 AC 7 ms
7,076 KB
testcase_27 AC 6 ms
7,076 KB
testcase_28 AC 6 ms
7,088 KB
testcase_29 AC 8 ms
7,068 KB
testcase_30 AC 7 ms
7,140 KB
testcase_31 AC 7 ms
7,084 KB
testcase_32 AC 7 ms
7,088 KB
testcase_33 AC 6 ms
7,076 KB
testcase_34 AC 7 ms
7,188 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

local s = io.read()
local t = {}
local n = #s
for i = 1, n do
  t[i] = s:byte(i)
end
if t[1] ~= t[2] and t[1] ~= t[3] then
  print("1 " .. s:sub(1, 1))
elseif t[n] ~= t[n - 1] and t[n] ~= t[n - 2] then
  print(n .. " " .. s:sub(n, n))
else
  for i = 2, n - 1 do
    if t[i - 1] ~= t[i] and t[i] ~= t[i + 1] then
      print(i .. " " .. s:sub(i, i))
      break
    end
  end
end
0