結果
| 問題 | No.539 インクリメント | 
| コンテスト | |
| ユーザー |  Ikazuchis_diary | 
| 提出日時 | 2017-07-04 22:23:34 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 937 bytes | 
| コンパイル時間 | 76 ms | 
| コンパイル使用メモリ | 12,672 KB | 
| 実行使用メモリ | 13,056 KB | 
| 最終ジャッジ日時 | 2024-10-05 16:17:37 | 
| 合計ジャッジ時間 | 1,778 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | WA * 1 RE * 2 | 
ソースコード
import re
T = int(input())
S = []
for i in range(T):
    S.append(input())
for s in S:
    minind = 0
    maxind = 0
    before = False
    longest = ''
    see = ''
    nowminind = 0
    for i in range(len(s)):
        if s[i] in {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}:
            if not before:
                nowminind = i
                before = True
            see += s[i]
        else:
            if len(see) >= len(longest):
                longest = see
                minind = nowminind
                maxind = i
            see = ''
            before = False
    if see != '':
        if len(see) >= len(longest):
            longest = see
            minind = nowminind
            maxind = len(s)
            see = ''
    if len(longest) == 0:
        print(s)
        continue
    ans = s[:minind]
    ans += ('%0' + str(len(longest)) + 'd') % (int(longest) + 1)
    ans += s[maxind:]
    print(ans)
            
            
            
        