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

import java.util.Scanner;

public class B {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.nextLine();
		String b = sc.nextLine();
		String c = sc.nextLine();
		int la = a.length(), lb = b.length(), lc = c.length();
		int ar[] = new int[26];
		for (int i = 0; i < la; i++)
			ar[a.charAt(i) - 97]++;
		int x = 0, y = 0;
		if (lb < lc) {
			while (x <= lb) {
				boolean flag = false;
				for (int i = 0; i < lb; i++) {
					int d = b.charAt(i) - 97;
					ar[d]--;// System.out.print((char)(d+97)+" "+ar1[d]+" ");
					if (ar[d] < 0) {
						flag = true;
						if(a.indexOf(d+97)!=-1){ar[d]++;}
						for(int j=i-1;j>=0;j--)ar[b.charAt(j) - 97]++;
						break;
					}
				}
				if (flag)
					break;
				x++; // System.out.println();
			}
			while (y <= lc) {
				boolean flag = false;
				for (int i = 0; i < lc; i++) {
					int d = c.charAt(i) - 97;
					ar[d]--;
					if (ar[d] < 0) {
						flag = true; 
						if(a.indexOf(d+97)!=-1){ar[d]++;}
						for(int j=i-1;j>=0;j--)ar[c.charAt(j) - 97]++;
						break;
					}
				}
				if (flag)
					break;
				y++;
			}
			for (int i = 0; i < x; i++)
				System.out.print(b);
			for (int i = 0; i < y; i++)
				System.out.print(c);
		} else {
			while (y <= lc) {
				boolean flag = false;
				for (int i = 0; i < lc; i++) {
					int d = c.charAt(i) - 97;
					ar[d]--;//System.out.print((char)(d+97)+" "+ar[d]+" ");
					if (ar[d] < 0) {
						flag = true; 
						if(a.indexOf(d+97)!=-1){ar[d]++;}
						for(int j=i-1;j>=0;j--)ar[c.charAt(j) - 97]++;
						break;
					}
				}
				if (flag)
					break;
				y++;
			}
			while (x <= lb) {
				boolean flag = false;
				for (int i = 0; i < lb; i++) {
					int d = b.charAt(i) - 97;
					ar[d]--;// 
					if (ar[d] < 0) {
						flag = true; 
						if(a.indexOf(d+97)!=-1){ar[d]++;}
						for(int j=i-1;j>=0;j--)ar[b.charAt(j) - 97]++;
						break;
					}
				}
				if (flag)
					break;
				x++; // System.out.println();
			}
			for (int i = 0; i < x; i++)
				System.out.print(b);
			for (int i = 0; i < y; i++)
				System.out.print(c);
		}

		for (int i = 0; i < 26; i++)
			for(int j=0;j<ar[i];j++)System.out.print((char) (i + 97));
	}
}