Mock CCC '21 S1 - Edit Distance

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 0.25s
Memory limit: 1G

Problem type

Given a string, an operation consists of either adding, changing, or removing one letter. The string must change.

Given an alphabet and an original string, compute all strings which are attainable from that string using one operation.

Constraints

1 \le |S| \le 100

Input Specification

The first line contains a string of lowercase letters, the alphabet of letters to use.

The second line contains the original string S.

Output Specification

Output all such strings in sorted order.

Sample Input

eg
egg

Sample Output

eeg
eegg
eg
ege
egeg
egge
eggg
gegg
gg
ggg

Comments

There are no comments at the moment.