← November 2025 questions

NOVEMBER 2025 / INTERMEDIATE / QUESTION 10

Adjacent Duplicate Removal

Archived question

Try the question in your own editor, then check your output below.

THE QUESTION

Text from the official booklet. Refer to the PDF for original mathematical notation, formatting, and linked input files. Printed samples and inputs are reproduced as published.

An AI jamming device emits corrupted sequences. Whenever two adjacent iden-
tical pulses appear, the purifier must delete them. After deletion, pulses collapse
together — and the check must repeat until no more adjacent duplicates exist.
Input format:
First line: An integer n — length of the signal string
Second line: A string of length n containing only uppercase letters
Output format:
A single string representing the cleaned signal
Sample Input:
28
AABBBCCCDDAABBAACCDDEE
Sample Output:
AE
Question Input:
1014
AAABBBCCCDDDDEEEFFFGGGHHHIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSS
TTTUUUVVVWWWXXXYYYZZZAAABBBCCCDDDDEEEFFFGGGHHHIIJJJKKKLLLMMM
NNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZAAABBBCCCDDDDEEEFFFGGG
HHHIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZAAABBB
CCCDDDDEEEFFFGGGHHHIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWW
XXXYYYZZZAAABBBCCCDDDDEEEFFFGGGHHHIIJJJKKKLLLMMMNNNOOOPPPQQQRRR
SSSTTTUUUVVVWWWXXXYYYZZZAAABBBCCCDDDDEEEFFFGGGHHHIIJJJKKKLLLMMM
NNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ

CHECK YOUR ANSWER

Try your answer.

The header says 1014, but only 468 characters are supplied. Use the full supplied string. The sample output also conflicts with the stated pair-removal rule; the checker follows the rule.

Run your program in your own editor, then paste its output below. This checks the stated output; it does not assess your full program. Practice attempts do not affect competition scores.

Use the question input above. Enter only the output.

Reveal worked answer

Your output

ABCEFGHJKLMNOPQRSTUVWXYZABCEFGHJKLMNOPQRSTUVWXYZABCEFGHJKLMNOPQRSTUVWXYZABCEFGHJKLMNOPQRSTUVWXYZABCEFGHJKLMNOPQRSTUVWXYZABCEFGHJKLMNOPQRSTUVWXYZ

Use a stack. Pop when the next character equals the top; otherwise push it. The final stack is the reduced string.

Source: Girls in Code SEA 2025 Fall Competition, 29 November 2025. Booklet created by Emily Xu and the GIC question authors. Shared for non-commercial educational use with attribution, as permitted in the booklet.