結果

問題 No.1469 programing
ユーザー mesame3993
提出日時 2021-11-15 00:52:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 511 ms / 3,000 ms
コード長 398 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 312,236 KB
最終ジャッジ日時 2024-11-30 12:12:28
合計ジャッジ時間 3,491 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  from sys import stdin
  input=stdin.readline
  s = input()[:-1]
  n = len(s)
  ans = []
  flag = False
  for i in range(n-1):
    if flag:
      flag = False
      continue
    if s[i] == s[i+1]:
      ans.append(s[i])
      flag = True
    else:
      ans.append(s[i])
  if n == 1:
    ans.append(s)
  else:
    if s[-1] != s[-2]:
      ans.append(s[-1])
  print(''.join(ans))
main()
0