brtakoktrosttttttttttosafasfkalsfkodfdasiofhadfhasdsajfdsafoasodsafahaihfdisoadspapsapiosapdsajdipsahdhasuirhaeuifhhfkjgosooooooooodafdfioottttafdsafaddfuiasdjfjasdo
okat
tako
 aleksandrehteosidatedodam
evo
si
 goodbyeihopecontestisntsohar
oh
god
 duxidimkeetoivas
dd
odi
 hellodeninobrdo
od
hel
 ikbalturkeybelieveinyou
bal
kan
 zdule
didins
meinkraft
 cumurcumur
um
cur
 ikatanictisinajboljiuhrvatskojakoprictasovojaviseakotijedosadno
javise
sine
 zlobobermyfriendandthanksforhelp
de
for
 navijamzaradnickiastabidrugo
druzina
djavola
 saljivdzijasamjaneki
neki
ja
 bumbumdzejsikerol
bumbum
bum
 svetislavgajicpoznatijikaosvetaxxx
slavi
slavu
 princeofpersiayouhavegreatcontestbutinwrongtime
op
pera
 pozdravizamarkamatovicaaleksandracveticainenadaslagalicustanisica
vas
rad
 dreamoonhasonedream
no
no
 jankosustersicneceovoraditi
cosovic
oce
 milenicnikolaitisideotakmicenja
elem
nik
 touristyouaregreatguy
tourist
guy
 lukavpastaakojelukav
a
u
 xxxbbbcccoca
ca
cb
 aaaaaabababaaa
aa
a
 petryouaregoodandyouhavegoodblogs
blog
rega
 lebronnojameslebronprogrammers
je
bro
 mztskopjetisisampiosrcenaterenostaviajdezanaspobedi
mzt
optee
 gukimikazedauradimseminarskidodatnohumorhumor
dp
mrzime
 razredninjegosgrebovicdobarcoveklosbasketas
ne
go
 pozdravzamojeodeljenjeiprofesoreocudabudempetnula
bojan
cao
 damandicnenapravicheckerzeznulibise
man
ker
 pozdravizazenskudecunecuvasodvajatidaseneprotumacipogresno
cao
deco
 egoryouaregoodbutcantsolveeverythinginonehour
eat
your
 lemigazalemiolemilicomzalemljenje
lemi
zlo
 randomusername
umno
umno
 thisiscornercase
youhavetwolongerstrings
ibelivethatyoudontmissit
 oduleodule
xgrizx
ivanstosicprvi
 molimprofesorkuengleskogdamidapetjasamdobarcovekitrudimseiztogaiakosamoperisan
hvala
unapred
 djeneralmilomirstefanovic
radi
nesto
 balsabratepozdravimajudevojku
oj
zdrav
 iwanttothanktomygrandmaheisveryimportantpersoninmylife
thanks
stanka

takotakotakotakotakoaaaaaaaaaaaaaaaaaaaaaabddddddddddddddddddeffffffffffffffffffghhhhhhhhhiiiiiiiiijjjjjloooooooooooooooooppppprrrssssssssssssssssssssstttttttttttuuu
 siaaaaddddeeeehklmnoorstt
 ohohgodabceeeiinnooprsssttty
 odiadeeiikmstuvx
 ododhelbeilnnor
 kanbbeeeeiiikllortuuvyy
 deluz
 umumcurcur
 sinesineaaaaaaaaabccddhiiiiiijjjjjkkkklnooooooooprrssstttttuvvv
 dedeforforaabbehhikllmnnnoprstyz
 druzinaaaaaabcdgiiijkmnorstv
 nekijajajaadiilmssvz
 bumbumdeeijklorsz
 slaviaaaaceegiiijjknoopsstttvvxxxz
 peraperaabcceeeefgghiiiimnnnnoooorrsstttttuuvwy
 vasvasvasradradradaaaaaaaaaaccccceeegiiiiiiikklllmmnnnnoopstttuzz
 nonoaaaddeeehmmorrs
 oceoceaadeiiijknnorrsssttuv
 elemniknikaaaccdeiiiiijlmnoostt
 touristguyguyaaeeorrt
 aaaaauuejkkkllopstvv
 cacbcbcboxxx
 aaaaaaaaaaabbb
 blogregaregaadddehnoooooopstuuvyy
 jebrobroaaeeegllmmmnnnooprrrss
 mztopteeopteeopteeaaaaaabcddiiiiijjkmnnnorrssssssvz
 mrzimeaaaaaddddeghhiiiikkkmmmnnoooorrrsstuuuu
 nenegogoaaaabbbccddeeeiijkklooorrrrsssstvvz
 bojancaoaaddddeeeeeeeefijjllmmnooooppprrrstuuuvzz
 mankeraaabcccddeeeehiiiilnnnprsuvzz
 decodecodecoaaaaaaadeeegiiijkmnnnnooppprrrssssttuuuuvvvzzz
 eateatyouryourbcdeeeeggghhiilnnnnooooorrstuvv
 lemilemilemilemizlozloaaaceegjjmn
 umnoaadeemnrrs
 acceehiinorrssst
 ddeelloouu
 unapredunapredaaaaaaabcddeeeeefgggiiiiiiijkkkkllmmmmmmoooooooooprrrsssssstttvz
 radinestoaceefiijllmmnorv
 ojojzdravaaaabbdeeiklmprstuuv
 stankaaaadeeeefghhiiiiilmmmmnnnnnoooopprrrrstttttvwyyy

a = input()
b = input()
c = input()

com = set(b).intersection(set(c))

aSet_dict = {}
comB_dict = {}
comC_dict = {}

leftB_dict = {}
leftC_dict = {}

def search(string, string_set, dictionary) :
    for ch in string_set:
        index = -1
        while True:
            index = string.find(ch, index + 1)
            if index >= 0:
                if ch in dictionary.keys():
                    dictionary[ch] = dictionary[ch] + 1
                else:
                    dictionary[ch] = 1
            else:
                break
def getMin(all_dic, dictionary):
    mMin = 100000
    for ch in dictionary.keys():
        if not ch in all_dic.keys():
            return 0
        if all_dic[ch] // dictionary[ch] < mMin:
            mMin = all_dic[ch] // dictionary[ch]
    return mMin

search(b, com, comB_dict)
search(c, com, comC_dict)

search(a, set(a), aSet_dict)

search(b, set(filter(lambda s: not s in com, set(b))), leftB_dict)
search(c, set(filter(lambda s: not s in com, set(c))), leftC_dict)

bMin = getMin(aSet_dict, comB_dict)
cMin = getMin(aSet_dict, comC_dict)

b_dict = comB_dict
c_dict = comC_dict
b_dict.update(leftB_dict)
c_dict.update(leftC_dict)

if bMin >= cMin:
    bbMin = getMin(aSet_dict, b_dict)
    if bbMin > 0:
        for ch in b_dict.keys():
            aSet_dict[ch] -= b_dict[ch] * bbMin
    
    ccMin = getMin(aSet_dict, c_dict)
    if ccMin > 0:
        for ch in c_dict.keys():
            aSet_dict[ch] -= c_dict[ch] * ccMin

    print(b * bbMin, end = "")
    print(c * ccMin, end = "")
    for ch in aSet_dict.keys():
        print(ch * aSet_dict[ch], end = "")
    print()
else:
    ccMin = getMin(aSet_dict, c_dict)
    if ccMin > 0:
        for ch in c_dict.keys():
            aSet_dict[ch] -= c_dict[ch] * ccMin

    bbMin = getMin(aSet_dict, b_dict)
    if bbMin > 0:
        for ch in b_dict.keys():
            aSet_dict[ch] -= b_dict[ch] * bbMin
            
    print(b * bbMin, end = "")
    print(c * ccMin, end = "")
    for ch in aSet_dict.keys():
        print(ch * aSet_dict[ch], end = "")
    print()
