import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner; import java.util.StringTokenizer; public class DNA_John { public static final int NUMCHARS = 4; public static final char[] letters = {'A', 'T', 'G', 'C'}; public static Scanner sin = new Scanner(System.in); public static int [][] segtrees = new int[NUMCHARS][]; public static String s; public static int len; public static void main(String [] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); s = in.readLine(); double log2 = Math.log(s.length())/Math.log(2); if ((int)log2 != log2) log2++; len = (int)Math.pow(2, (int)log2); // System.out.println(len); for(int i=0; i low) { len /= 2; int mid = low+len-1; buildTrees(2*index+1, low, mid, len); buildTrees(2*index+2, mid+1, high, len); for(int i=0; i counts.count[max]) max = j; System.out.print(letters[max]); counts.count[max] = -1; } System.out.println(); } public static void processQuery(int index, int low, int high, int rangelow, int rangehigh, Tuple ans) { // System.out.println(index + " " + low + " " + high + " " + rangelow + " " + rangehigh); // String s; // s = sin.nextLine(); if (low == rangelow && high == rangehigh) { for(int i=0; i high) return; int mid = (rangelow+rangehigh)/2; if (low > mid) processQuery(2*index+2, low, high, mid+1, rangehigh, ans); else if (high < mid) processQuery(2*index+1, low, high, rangelow, mid, ans); else { processQuery(2*index+1, low, mid, rangelow, mid, ans); Tuple tmp = new Tuple(); processQuery(2*index+2, mid+1, high, mid+1, rangehigh, tmp); for(int i=0; i