P26909 [AtCoder] Overwrite
普及+
题目描述

Problem Description

Given a string \( S \) of length \( N \) consisting of lowercase English letters.
There is also a string \( T \), which is initially an empty string.

You will perform the following operation for \( i = 1, 2, \dots, N \) in order, starting from \( i = 1 \):

  • Let \( c \) be the \( i \)-th character from the left of \( S \). Remove all characters in \( T \) that are the same as \( c \), and then append \( c \) to the end of \( T \).

Determine the final \( T \) after all operations are completed.

Input Format

The input is given from the standard input in the following format:

\( N \) \( S \)

Output Format

Output the final \( T \) after all operations are completed.

Sample Input and Output

Sample Input #1

3
aba

Sample Output #1

ba

Sample Input #2

7
sptaast

Sample Output #2

past

Sample Input #3

30
ryfoxchyvfmsewlwpoyvhdjkbvdjsa

Sample Output #3

rxcfmelwpoyhkbvdjsa

Notes/Hints

Constraints

  • \( 1 \le N \le 100 \)
  • \( S \) is a string of length \( N \) consisting of lowercase English letters

Sample Explanation 1

Initially, \( T \) is an empty string. In the first operation, append a to the end of \( T \), so it becomes a. In the second operation, append b to the end of \( T \), so it becomes ab. In the third operation, remove a from \( T \) to make it b, and then append a to the end, so it becomes ba.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 aba
样例输出
ba