1 import java.util.Scanner; 2 3 public class Main { 4 public static void main(String[] args) { 5 // TODO Auto-generated method stub 6 Scanner input = new Scanner(System.in); 7 int T = input.nextInt(); 8 while (T-- > 0) { 9 String str = input.next(); 10 deal(str); 11 System.out.println(); 12 } 13 } 14 15 public static void deal(String str) { 16 for (int i = 0; i < str.length(); i++) { 17 if (str.charAt(i) == '-') { 18 if (i == 0 || i == str.length() - 1) { 19 System.out.print('-'); 20 } else { 21 if (str.charAt(i - 1) >= 'a' && str.charAt(i - 1) <= 'z' && str.charAt(i + 1) >= 'a' 22 && str.charAt(i + 1) <= 'z' && str.charAt(i - 1) <= str.charAt(i + 1)) { 23 for (int j = (int) (str.charAt(i - 1) + 1); j < (int) (str.charAt(i + 1)); j++) { 24 System.out.print((char) (j)); 25 } 26 } else if (str.charAt(i - 1) >= '0' && str.charAt(i - 1) <= '9' && str.charAt(i + 1) >= '0' 27 && str.charAt(i + 1) <= '9' && str.charAt(i - 1) <= str.charAt(i + 1)) { 28 for (int j = (int) (str.charAt(i - 1) + 1); j < (int) (str.charAt(i + 1)); j++) { 29 System.out.print((char) (j)); 30 } 31 } else if (str.charAt(i - 1) >= 'A' && str.charAt(i - 1) <= 'Z' && str.charAt(i + 1) >= 'A' 32 && str.charAt(i + 1) <= 'Z' && str.charAt(i - 1) <= str.charAt(i + 1)) { 33 for (int j = (int) (str.charAt(i - 1) + 1); j < (int) (str.charAt(i + 1)); j++) { 34 System.out.print((char) (j)); 35 } 36 } else 37 System.out.print('-'); 38 39 } 40 } else 41 System.out.print(str.charAt(i)); 42 } 43 } 44 }