結果

問題 No.1367 文字列門松
ユーザー mesame3993
提出日時 2021-12-09 01:45:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 669 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 82,332 KB
実行使用メモリ 53,576 KB
最終ジャッジ日時 2024-07-16 12:30:50
合計ジャッジ時間 2,257 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  from sys import stdin
  readline = stdin.readline
  s = readline()[:-1]
  n = len(s)
  t = 'kadomatsu'
  if n > len(t):
    print('No')
    exit()
  arr_t = [x for x in t]
  delta = []
  for i in range(n):
    if s[i] in arr_t:
      delta.append(arr_t.index(s[i]))
      if arr_t.index(s[i]) >= 1 and s[i] != 'a' and 'a' in arr_t:
        arr_t.remove('a')
      arr_t.remove(s[i])
    else:
      print('No')
      exit()
  flag = (delta == list(sorted(delta)))
  print('Yes' if flag else 'No')


  
if __name__ == "__main__":
  import sys
  readline = sys.stdin.readline
  def error(*args, end='\n'):
    print(*args, end=end, file=sys.stderr)
  main()
0