結果

問題 No.1469 programing
ユーザー harurunharurun
提出日時 2021-04-03 01:13:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 555 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 17,920 KB
最終ジャッジ日時 2023-08-26 04:16:19
合計ジャッジ時間 2,815 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,872 KB
testcase_01 AC 15 ms
7,832 KB
testcase_02 AC 14 ms
7,832 KB
testcase_03 AC 14 ms
7,836 KB
testcase_04 AC 15 ms
7,840 KB
testcase_05 AC 16 ms
7,940 KB
testcase_06 AC 16 ms
7,792 KB
testcase_07 AC 16 ms
7,876 KB
testcase_08 AC 57 ms
8,380 KB
testcase_09 AC 72 ms
8,260 KB
testcase_10 AC 71 ms
8,508 KB
testcase_11 AC 106 ms
8,704 KB
testcase_12 AC 82 ms
8,304 KB
testcase_13 AC 15 ms
7,796 KB
testcase_14 AC 135 ms
8,664 KB
testcase_15 AC 137 ms
8,760 KB
testcase_16 RE -
testcase_17 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  S=input()
  assert(0<=len(S)<=3*(10**5))
  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