#include using namespace std; typedef long long ll; #define REP(i,a,n) for(ll i=(a); i<(ll)(n); i++) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(v) (v).begin(), (v).end() int main(void) { int T,st=0,en=0; int level; cin >> T; string strs[T]; cin.ignore(); for (int i=0; i=0; j--) { if (!line) { if (isdigit(str[j])) { en = j; line = !line; } } else { if (!isdigit(str[j]) || str[j] == '0') { isZero = str[j] == '0'; st = j+1; break; } } } if (!line) { strs[i] = str; continue; } isNine = str.front() == '9'; level = stoi(str.substr(st, en - st + 1)) + 1; if (isZero && isNine) st--; strs[i] = str.substr(0, st) + to_string(level) + str.substr(en+1, str.size() - 1); } for (int i=0; i