結果
| 問題 | 
                            No.1362 [Zelkova 8th Tune] Black Sheep
                             | 
                    
| コンテスト | |
| ユーザー | 
                            👑  | 
                    
| 提出日時 | 2021-01-22 21:34:45 | 
| 言語 | Lua  (LuaJit 2.1.1734355927)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 9 ms / 1,000 ms | 
| コード長 | 379 bytes | 
| コンパイル時間 | 351 ms | 
| コンパイル使用メモリ | 6,688 KB | 
| 実行使用メモリ | 7,424 KB | 
| 最終ジャッジ日時 | 2024-12-27 22:01:12 | 
| 合計ジャッジ時間 | 1,790 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 38 | 
ソースコード
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