public static void getTrueString() {
    Scanner sc = new Scanner(System.in);  int n = Integer.parseInt(sc.nextLine());  for (int i = 0; i < n; i++) { char[] str = sc.nextLine().toCharArray();  LinkedList<Character> list = new LinkedList<>();  for (char ch : str) { int index = list.size();  if ((index - 2) >= 0 && list.get(index - 1) == ch && list.get(index - 2) == ch) { //三个相同  continue;  } if ((index - 3) >= 0 && list.get(index - 3) == list.get(index - 2) && list.get(index - 1) == ch) { continue;  }
            list.add(ch);  } for (int j = 0; j < list.size(); j++) {
            System.out.print(list.get(j));  }
        System.out.println();  }
}