output_description: Print one longest subsequence that satisfies the conditions. If multiple
  solutions exist, any of them will be accepted.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S
attempt: s = input()
  a = 0
  b = 0
  c = 0
  for i in range(len(s)):
      if s[i] == "A":
          a = a + 1
      if s[i] == "B":
          b = b + 1
      if s[i] == "C":
          c = c + 1
  
  little = 0
  
  
  if a <= b:
      if a <= c:
          little = a
      if a >= c:
          little = c
  else:
      if b <= c:
          little = b
      if b >= c:
          little = c
  
  
  dl = ""
  
  for i in range(little):
      dl = "" + dl + "ABC"
  print(dl)
  
problem_description: Statement
  
  Given is a string S consisting of `A`,`B`, and `C`.
  
  Consider the (not necessarily contiguous) subsequences x of S that satisfy all
  of the following conditions:
  
    * `A`, `B`, and `C` all occur the same number of times in x.
    * No two adjacent characters in x are the same.
  
  Among these subsequences, find one of the longest. Here a subsequence of S is
  a string obtained by deleting zero or more characters from S.
samples: [{"input": "ABBCBCAB", "output": "ACBCAB\n    \n\nConsider the subsequence `ACBCAB` of S. It satisfies the conditions and is one\nof the longest with these properties, along with `ABCBCA`. On the other hand,\nthe subsequences `ABCBCAB` and `ABBCCA` do not satisfy the conditions.\n\n* * *"}, {"input": "ABABABABACACACAC", "output": "BABCAC\n    \n\n* * *"}, {"input": "ABCABACBCBABABACBCBCBCBCBCAB", "output": "ACABACABABACBCBCBCBCA\n    \n\n* * *"}, {"input": "AAA", "output": "It is possible that only the empty string satisfies the condition."}]