Under construction

Still being built. Things may change

Last Letter

Time limit2sMemory limit1024 MB

Summary
Given a string S, print the result of removing its last character if that character is G, or appending G to the end otherwise.
Level

Easy1 of 10

Topics
String, Implementation
Solved
No attempts yet

Problem

Aoi is a student at JOI High School. Aoi noticed that appending the character G to the end of the string JOI gives JOIG.

After that, Aoi plays with various strings by appending G to the end or removing a trailing G.

Specifically, when Aoi sees a string, Aoi plays as follows.

  • If the last character of the string is G, Aoi imagines the string with that last character G removed. Only the last single character is removed.
  • If the last character of the string is not G, Aoi imagines the string with G appended to the end.

A string S of length N is given. Write a program that outputs the string Aoi imagines when seeing S.

Input

The input is given in the following format.

N
S

Output

Print the string that Aoi imagines when seeing S.

Constraints

  • 2 ≤ N ≤ 100.
  • S is a string of length N.
  • Each character of S is an uppercase English letter.
  • N is an integer.

Examples3

  1. Example 1

    Input
    4
    JOIG
    
    Expected output
    JOI
    
  2. Example 2

    Input
    3
    JOI
    
    Expected output
    JOIG
    
  3. Example 3

    Input
    3
    EGG
    
    Expected output
    EG