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

def getReps(a,x):
	nx = len(a)
	for i in x:
		if i not in a:
			nx = 0
			break
		nx = min(nx,a[i] / x[i])
	return nx

if __name__ == '__main__':
	a = raw_input()
	b = raw_input()
	c = raw_input()
	ca = {}
	cb = {}
	cc = {}
	for l in a:
		ca[l] = ca.setdefault(l,0) + 1
	for l in b:
		cb[l] = cb.setdefault(l,0) + 1
	for l in c:
		cc[l] = cc.setdefault(l,0) + 1

	k = ''
	best_k = ''
	total = 0
	best = 0
	#Mixed
	while True:
		nb = getReps(ca, cb)
		nc = getReps(ca, cc)
		if nc==0 and nb==0:
			break

		if nb > nc:
			for i in cb:
				ca[i] -= cb[i]
			k += b
			total += 1
		else:
			for i in cc:
				ca[i] -= cc[i]
			k += c
			total += 1
	for i in ca:
		k += i*ca[i]
	if total > best:
		best_k = k
		best = total
	#b first
	ca = {}
	cb = {}
	cc = {}
	for l in a:
		ca[l] = ca.setdefault(l,0) + 1
	for l in b:
		cb[l] = cb.setdefault(l,0) + 1
	for l in c:
		cc[l] = cc.setdefault(l,0) + 1
	k = ''
	total = 0
	nb = getReps(ca, cb)
	if nb > 0:
		for i in cb:
			ca[i] -= nb*cb[i]
		k += nb*b
		total += nb
	nc = getReps(ca, cc)
	if nc > 0:
		for i in cc:
			ca[i] -= nc*cc[i]
		k += nc*c
		total += nc
	for i in ca:
		k += i*ca[i]
	if total > best:
		best_k = k
		best = total
	#c first
	ca = {}
	cb = {}
	cc = {}
	for l in a:
		ca[l] = ca.setdefault(l,0) + 1
	for l in b:
		cb[l] = cb.setdefault(l,0) + 1
	for l in c:
		cc[l] = cc.setdefault(l,0) + 1
	k = ''
	total = 0
	nc = getReps(ca, cc)
	if nc > 0:
		for i in cc:
			ca[i] -= nc*cc[i]
		k += nc*c
		total += nc
	nb = getReps(ca, cb)
	if nb > 0:
		for i in cb:
			ca[i] -= nb*cb[i]
		k += nb*b
		total += nb
	for i in ca:
		k += i*ca[i]
	if total > best:
		best_k = k
		best = total
	print best_k