結果

問題 No.539 インクリメント
ユーザー Ikazuchis_diaryIkazuchis_diary
提出日時 2017-07-04 22:04:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 499 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 13,056 KB
最終ジャッジ日時 2024-04-15 16:19:18
合計ジャッジ時間 1,245 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 WA -
testcase_02 RE -
testcase_03 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import re

T = int(input())
S = []
for i in range(T):
    S.append(input())

for s in S:
    pattern = r'\d+'
    iterator = re.finditer(pattern, s)
    match = 0
    longest = 0
    for i in iterator:
        if len(i.group()) >= longest:
            match = i
            longest = len(i.group())
    if match == 0:
        print(s)
        continue
    ans = s[:match.start()]
    ans += ('%0' + str(len(match.group())) + 'd') % (int(match.group()) + 1)
    ans += s[match.end():]
    print(ans)
0