Back
Close

Shakespeare stitching

Statement
Given [[N]] overlapping fragments of a Shakespeare quote, rebuild the original quote. Each fragment can only be used once. All the fragments must be used and there is always only one solution

Input description
<<Line 1:>> An integer [[N]] for the number of fragments <<Next [[N]] lines:>> A fragment of the quote

Output description
One string for the complete quote

Constraints
1 < [[N]] < 10

Game modes

Test cases
All's Well That Ends Well Test
Input
2 few, do wrong to none. Love all, trust a few, do
Output
Love all, trust a few, do wrong to none.

Base case validator Validator
Input
2 few, do wrong toX none. Love all, trust a few, do
Output
Love all, trust a few, do wrong toX none.

As You Like It Test
Input
3 The fool doth think he is wise wise man knows himself to be a fool. wise, but the wise
Output
The fool doth think he is wise, but the wise man knows himself to be a fool.

Repeating words validator Validator
Input
3 The fool doXth think he is wise wise man knows himself to be a fool. wise, but the wise
Output
The fool doXth think he is wise, but the wise man knows himself to be a fool.

Hamlet Test
Input
4 the day, thou canst not then be false to any man. This above all: to thine own self must follow, as the night the day, thou own self be true, and it must follow, as
Output
This above all: to thine own self be true, and it must follow, as the night the day, thou canst not then be false to any man.

Many fragments validator Validator
Input
4 the day, thou canst not then be false to any man. This above all:X to thine own self must follow, as the night the day, thou own self be true, and it must follow, as
Output
This above all:X to thine own self be true, and it must follow, as the night the day, thou canst not then be false to any man.

Twelfth Night Test
Input
7 afraid of greatness. Be not afraid some achieve greatness greatness thrust upon them. greatness. Some Some are born great, some greatness, and others have greatness
Output
Be not afraid of greatness. Some are born great, some achieve greatness, and others have greatness thrust upon them.

Complete validator Validator
Input
7 afraid of greatness. Be nXt afraid some achieve greatness greatness thrust upon them. greatness. Some Some are born great, some greatness, and others have greatness
Output
Be nXt afraid of greatness. Some are born great, some achieve greatness, and others have greatness thrust upon them.

Solution language

Solution

Stub generator input