結果
| 問題 |
No.2738 CPC To F
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-04-20 10:47:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 711 bytes |
| コンパイル時間 | 286 ms |
| コンパイル使用メモリ | 82,376 KB |
| 実行使用メモリ | 76,836 KB |
| 最終ジャッジ日時 | 2024-10-12 06:21:53 |
| 合計ジャッジ時間 | 2,609 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | WA * 22 |
ソースコード
from collections import defaultdict
def transformString(S):
counter = defaultdict(lambda : 0)
max_consecutive_count = 0
for i in range(len(S)):
if i == 0 or S[i] != S[i-1]:
if S[i] == 'C':
counter[S[i]] += 1
else:
max_consecutive_count = max(max_consecutive_count,counter[S[i]])
counter[S[i]] += 1
elif S[i] == 'C':
counter[S[i]] += 1
elif S[i] == 'T':
counter[S[i]] += 1
if counter[S[i]] == 0:
max_consecutive_count = max(max_consecutive_count,counter[S[i]])
return max_consecutive_count
N = int(input())
s = input()
print(transformString(s))