import java.util.*; public class Main { static void solve (String[] ar, int n) { String s; int start = -1; int end = -1; StringBuilder sb = new StringBuilder(); StringBuilder num1 = new StringBuilder(); StringBuilder num2 = new StringBuilder(); int leng = 0; int temp = 0; String c; for (int i=0; i=1; j--) { c = s.substring(j-1,j); if (end==-1 && c.matches("[0-9]")) { end = j; start = j; } if (end!=-1 && c.matches("[0-9]")==false) { break; } if (end!=-1 && c.matches("[0-9]")) { start--; } } if (start==-1 && end==-1) { System.out.println(s); } else { sb.append(s); sb.delete(start,end); num1.append(s.substring(start,end)); num2.append(increment(s.substring(start,end))); if (num2.length() < num1.length()) { leng = num1.length()-num2.length(); for (int k=0; k=1; i--) { temp = up + Integer.parseInt(s.substring(i-1,i)); ans.insert(0,temp%10); up = temp/10; } if (up!=0) {ans.insert(0,up);} return ans.toString(); } public static void main(String[] args) { int n = sc.nextInt(); sc.nextLine(); String[] ar = new String[n]; for (int i=0; i