• + 0 comments
    import java.io.*;
    import java.util.*;
    import java.util.regex.*;;
    
    public class Solution {
    
        public static void main(String[] args) {
          Scanner sc = new Scanner(System.in);
          while(sc.hasNext()) {
            int t = Integer.parseInt(sc.next());
            if(sc.hasNext(Pattern.compile("[0-9]+"))) {
              Integer[] ints = new Integer[t];
              for (int i = 0; i < t; i++) {
                ints[i] = sc.nextInt();
              }
              printArray(ints);
            } else {
              String[] strs = new String[t];
              for (int i = 0; i < t; i++) {
                strs[i] = sc.next();
              }
              printArray(strs);
            }
          }
          
          sc.close();
        }
        
        
        public static <T> void printArray(T[] array) {
          for (T t : array) {
            System.out.println(t);
          }
        }
    }