← November 2025 questions

NOVEMBER 2025 / INTERMEDIATE / QUESTION 9

Signal Compression by RPCU

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.

During the invasion, AI drones transmit long strings of signal pulses. These signals
are extremely repetitive. The RPCU compresses these transmissions so human an-
alysts can store them efficiently.
The rule is simple: Whenever a letter repeats consecutively, compress it into<letter><count>.
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 compressed signal
Sample Input:
35
Sample Output:
AAAABBCCCCCDDDDAAABBBBBBBEEEFFFFF
Question Input:
1233
FJJJJAAAZZZZBBBCCDDDEEEFFGGHHIIIIKKLLMMMMNNNNOOOPPPQQQQRRR
RSSTTTUUUVVVWWXXXYYYZZAAABBCCCCDDDDEEEFFFGGGHHHIIJJJKKKLLL
MMMNNNOOOPPPQQQQRRRRSSSSTTTUUUUVVVVWWWWXXXYYYZZZAAAABBBCCCD
DDDEEEFFFGGGHHHHIIIIJJJJKKKLLLMMMNNNNOOOOPPPQQQQRRRRSSSSTTT
UUUUVVVVWWWWXXXYYYYZZZZAAAABBBBCCCDDDDEEEFFFGGGHHHHIIIIJJJJ
KKKKLLLLMMMNNNNOOOOPPPQQQQRRRRSSSSTTTUUUUVVVVWWWWXXXXYYYYZZ
ZZAAAABBBBCCCCDDDDEEEFFFGGGHHHHIIIIJJJJKKKKLLLLMMMNNNNOOOOP
PPQQQQRRRRSSSSTTTUUUUVVVVWWWWXXXXYYYYZZZZAAAABBBBCCCCDDDDEE
EEFFFGGGHHHHIIIIJJJJKKKKLLLLMMMNNNNOOOOPPPQQQQRRRRSSSSTTTUU
UUVVVVWWWWXXXXYYYYZZZZAAAABBBBCCCDDDDEEEFFFGGGHHHHIIIIJJJJ
KKKKLLLLMMMNNNNOOOOPPPQQQQRRRRSSSSTTTUUUUVVVVWWWWXXXXYYYYZZ
ZZAAAABBBBCCCCDDDDEEEFFFGGGHHHHIIIIJJJJKKKKLLLLMMMNNNNOOOOP
PPQQQQRRRRSSSSTTTUUUUVVVVWWWWXXXXYYYYZZZZ

CHECK YOUR ANSWER

Try your answer.

The printed length 1233 disagrees with the 746 supplied characters. This check compresses the full supplied string without padding.

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

F1J4A3Z4B3C2D3E3F2G2H2I4K2L2M4N4O3P3Q4R4S2T3U3V3W2X3Y3Z2A3B2C4D4E3F3G3H3I2J3K3L3M3N3O3P3Q4R4S4T3U4V4W4X3Y3Z3A4B3C3D4E3F3G3H4I4J4K3L3M3N4O4P3Q4R4S4T3U4V4W4X3Y4Z4A4B4C3D4E3F3G3H4I4J4K4L4M3N4O4P3Q4R4S4T3U4V4W4X4Y4Z4A4B4C4D4E3F3G3H4I4J4K4L4M3N4O4P3Q4R4S4T3U4V4W4X4Y4Z4A4B4C4D4E4F3G3H4I4J4K4L4M3N4O4P3Q4R4S4T3U4V4W4X4Y4Z4A4B4C3D4E3F3G3H4I4J4K4L4M3N4O4P3Q4R4S4T3U4V4W4X4Y4Z4A4B4C4D4E3F3G3H4I4J4K4L4M3N4O4P3Q4R4S4T3U4V4W4X4Y4Z4

Scan maximal runs and emit their character followed by run length, including runs of length 1. Join wrapped lines before counting.

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.