IPSC Logo

Internet Problem Solving Contest

IPSC 2013

Problem R – Rearranged alphabet

The string abcabac has a peculiar property: each permutation of a, b, and c occurs in it as a subsequence:

                                      abcabac  
                                      -------  
                                      a   b c  
                                      a c b  
                                       b a  c  
                                       bca  
                                        cab  
                                        c ba

Your task is to find such a string for the entire English alphabet. That is, a string such that each of the 26! permutations of a through z occurs in it as a subsequence.

Input specification

There is no input.

Output specification

Your output must contain a single line with a string of lowercase English letters.

For the easy subproblem R1 we will accept any valid string that has at most 660 letters.

For the hard subproblem R2 we will accept any valid string that has at most 640 letters.

(There are valid answers shorter than 630 letters.)