結果

問題 No.1469 programing
ユーザー harurun
提出日時 2021-04-03 01:21:43
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 2,306 ms / 3,000 ms
コード長 555 bytes
コンパイル時間 350 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 20,312 KB
最終ジャッジ日時 2024-12-24 18:20:31
合計ジャッジ時間 5,099 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  S=input()
  assert(0<=len(S)<=5*(10**6))
  if len(S)!=0:
    #英小文字かどうか
    for i in S:
      assert(ord("a")<=ord(i)<=ord("z"))
    if len(S)>2:
      #3文字以上続いてないか(3文字続いているかの確認で3文字以上も確認できる)
      for i in range(len(S)-2):
        if S[i]==S[i+1] and S[i+1]==S[i+2]:
          raise Exception("3 or more continues.")
  if len(S)<2:
    print(S)
    return
  ans=S[0]
  for i in range(1,len(S)):
    if S[i-1]!=S[i]:
      ans+=S[i]
  print(ans)
  return

main()
0