Open Wide

Time: 1.0 s     Memory: 1024 MB
  • It’s time for a dental visit! Your dentist happens to be interested in both DNA strands and problem-solving. While the dentist is busy tinkering with your teeth, they give you the following problem.

    \includegraphics[width=0.8\textwidth ]{gapastort.jpg}
    Figure 1: Picture from www.rawpixel.com

    You are given an $N$ long substring of a DNA string, where all $N$ characters are guaranteed to be one of G, T, C, or A.

    You want to find another DNA substring of length $N$ that differs from the given DNA string at each position.

    Can you find the lexicographically smallest of all these possible DNA strings?

    Input

    The first line of input contains the integer $N$ ($1 \leq N \leq 1000$). The second line contains a string with $N$ characters, where all characters are either G, T, C, or A.

    Output

    Write out a string with $N$ characters, where all characters must be G, T, C, or A. This string should differ from the given string at every position.

    Points

    You can recieve up to 100 points depending on how well you solve the problem.

    Note: In this problem, the size of the file you submit cannot exceed 1 kB.

    Sample Input 1 Sample Output 1
    1
    T
    
    A
    
    Sample Input 2 Sample Output 2
    5
    ACAGT
    
    CACAA
    
April fools 2024
You must log in to submit solutions to the problem.
{"contest_start_timestamp": 1711962000, "contest_duration": 7200, "contest_started": true, "contest_ended": true, "flexible_start_window_end_time": null, "only_virtual": false}