← March 2025 questions

MARCH 2025 / INTERMEDIATE / LEVEL 2 · QUESTION 1

Level 2 · Question 1

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.

Scenario: A STEM awareness campaign wants to generate unique hashtags based on the
initials of notable women in STEM. A campaign focuses on Marie Curie (Physics &
Chemistry), Ada Lovelace (Computer Science), and Rosalind Franklin (Biology).
They use their initials (mar) to generate unique permutations for hashtag variations:
●   mar, mra, amr, arm, rma, ram
Problem Statement:
Given a string S (1 ≤ |S| ≤ 8), consisting of lowercase letters, representing the initials of STEM
pioneers, print all unique permutations in lexicographical (alphabetical) order, one per line.
Sample Input:
mar
Sample Output:
amr
arm
mar
mra
ram
rma
Your Input: ada

CHECK YOUR ANSWER

Try your answer.

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 corresponding input from the question. For lists, brackets and commas are optional for numeric answers; text lists may also be entered one item per line.

Reveal worked answer

Your output

aad
ada
daa

Generate permutations, remove duplicates, then sort alphabetically: aad, ada, daa.

Reveal supplied answer

From the supplied Intermediate answer key. Outputs are reproduced as provided.

Expected output

aad
ada
daa

Source: GIC 2025 Intermediate Questions and the supplied Intermediate answer key, March 2025 archive.