#include <iostream>
#include <string>
#include <queue>
using namespace std;
std::queue<int> Q[5];
int ci(char c) {
  switch (c) {
    case ('A'): { return 0; break; }
    case ('G'): { return 1; break; }
    case ('C'): { return 2; break; }
    case ('T'): { return 3; break; }
    default: { break; }
  }
  return 4;
}
char ic(int i) {
  switch (i) {
    case (0): { return 'A'; break; }
    case (1): { return 'G'; break; }
    case (2): { return 'C'; break; }
    case (3): { return 'T'; break; }
    default: { break; }
  }
  return '$';  
}
string pre(string str) {
  int i=0; int len=str.length();
  string res="";
  for (;i<len;) {
    char cc=str[i]; i++;
    while (i<len&&str[i]==cc) {i++;}
    res+=cc;
  }
  return res;
}
int main() {
  std::string str;
  cin>>str; int len = str.length();
  for (int i=0; i<4; i++) { Q[i]={}; } 
  //str = pre(str);
  for (int i=0; i<len; i++) { Q[ci(str[i])].push(i); }
  /*
  for (char ch : str) {
    I[(int)(ch-'A')]++;
  }*/
  int cur=-1;
  string res="";
  bool llf=false;
  
  // basically the same loop but modified to find the 
  // last occurance of characters, jump, till
  // reaching the end.
  // this's something seemingly new for me again. 
  // like everyday I lost hope on learning anything new in coding
  // like everything has been so well-developed
  // but now I spotted yet another new way to think about
  // ***** strings, wow. 
  // as for the tools used, well, yet again, ***** queue,
  // so nothing has actually been learnt. 
  // this is programming! You learnt nothing everyday,
  // and yet you are working hard. 
  
  while (cur<len) {
    int ts=-1; int mi=-1;
    for (int i=0; i<4; i++) {
      while (!Q[i].empty()) {
        int qf = Q[i].front();
        if (qf<cur) { Q[i].pop(); }
        else { break; } 
      }
      if (Q[i].empty()) {
        res+=ic(i); cur=len; llf=true; break;
      }
      if (mi==-1||(int)Q[i].front()>mi) {
        mi=Q[i].front(); ts=i;
      }
    }
    if (llf) break;
    res+=ic(ts); 
    cur=mi+1;
  }
  if (!llf) { res+=ic(0); }
  printf("%s",res.c_str());
  /*
  int mc=-1; int ms=-1;
  for (int i=0; i<26; i++) {
    if (I[i]>0) {
      if (ms==-1||mc>I[i]) {
        ms=i; mc=I[i];
      }
    }
  }
  for (int i=0; i<=mc; i++) {
    printf("%c",(char)('A'+ms));
  } */
  return 0;
}


/*
Indeed very insane. Even for this super simple question:

You are given a DNA sequence consisting of characters A, C, G, and T.

Your task is to find the shortest DNA sequence that is not a subsequence 
of the original sequence.

The question setter requires a method better than
simple looping I mean (-_-)

Simply incredible, like those questions and ideas are
little kid game like concepts, and yet a human needs to spend some 
time to think of it. 

That's why I always think of God and Satan, because how could humans
have such depth in thinking and unlimited authority? 

Sometimes it could be quite discouraging that no matter how 
many times one practise for it, the ability to solve Q is 
already limited by what we have developed at the age of 3, such that
someone is destined to become a math professor while others
cannot. 

The fact that all these is public is like a kind of insult from top people to
the commoners like us, like 
"we have literally listed out all the secrets online and yet you"
"still can't solve it"

Just as music. Those electronic music, etc. Billions of people view music videos, 
but only a couple hundred of songs are famous, but billions of people have already
watched and listened to every single details of the songs. If anything can be 
practiced, then billions of people should have already become music masters
by now after listening to so many songs. 

There's black magic in this world (-_-)
*/


/*
shortest subsequence, looks super easy
BUT, yet again, wrong answer again? 
This looks so easy and the idea is also so easy. 
whatever.
Oh wrong. It appears that I don't understand the Q.
Crazy, even for seemingly super simple Q statement,
there's still some interesting details. 
I wonder who have invented all these? 
To be honest, having such opportunity to know what 
CS professors are doing is simply interesting.
And, yes, there are barriers of entry.
When people are busying discouraging ppl,
I am honestly learning so much yet so little at the same time.
Wow, people honestly only look at wrong answers. 
*/
 
by

C++ Online Compiler

Write, Run & Share C++ code online using OneCompiler's C++ online compiler for free. It's one of the robust, feature-rich online compilers for C++ language, running on the latest version 17. Getting started with the OneCompiler's C++ compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as C++ and start coding!

Read inputs from stdin

OneCompiler's C++ online compiler supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample program which takes name as input and print your name with hello.

#include <iostream>
#include <string>
using namespace std;

int main() 
{
    string name;
    cout << "Enter name:";
    getline (cin, name);
    cout << "Hello " << name;
    return 0;
}

About C++

C++ is a widely used middle-level programming language.

  • Supports different platforms like Windows, various Linux flavours, MacOS etc
  • C++ supports OOPS concepts like Inheritance, Polymorphism, Encapsulation and Abstraction.
  • Case-sensitive
  • C++ is a compiler based language
  • C++ supports structured programming language
  • C++ provides alot of inbuilt functions and also supports dynamic memory allocation.
  • Like C, C++ also allows you to play with memory using Pointers.

Syntax help

Loops

1. If-Else:

When ever you want to perform a set of operations based on a condition If-Else is used.

if(conditional-expression) {
   //code
}
else {
   //code
}

You can also use if-else for nested Ifs and If-Else-If ladder when multiple conditions are to be performed on a single variable.

2. Switch:

Switch is an alternative to If-Else-If ladder.

switch(conditional-expression){    
case value1:    
 // code    
 break;  // optional  
case value2:    
 // code    
 break;  // optional  
......    
    
default:     
 code to be executed when all the above cases are not matched;    
} 

3. For:

For loop is used to iterate a set of statements based on a condition.

for(Initialization; Condition; Increment/decrement){  
  //code  
} 

4. While:

While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.

while (condition) {  
// code 
}  

5. Do-While:

Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.

do {  
 // code 
} while (condition); 

Functions

Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increases re-usuability and modularity. Function gets run only when it is called.

How to declare a Function:

return_type function_name(parameters);

How to call a Function:

function_name (parameters)

How to define a Function:

return_type function_name(parameters) {  
 // code
}