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.io.BufferedWriter;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Scanner;

public class b307 {
	static char[] a, b, c;
	static StringBuilder ansb, ansc;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		a = in.nextLine().toCharArray();
		b = in.nextLine().toCharArray();
		c = in.nextLine().toCharArray();
		in.close();
		int[] numA = new int[26];
		int[] numB = new int[26];
		int[] numC = new int[26];
		for (char aa : a)
			numA[aa - 'a']++;
		for (char bb : b)
			numB[bb - 'a']++;
		for (char cc : c)
			numC[cc - 'a']++;
		int max1 = solveB(numA, numB, numC);
		int max2 = solveC(numA, numB, numC);
		PrintWriter out = new PrintWriter(new BufferedWriter(
				new OutputStreamWriter(System.out)));
		if (max1 >= max2)
			out.println(ansb);
		else
			out.println(ansc);
		out.flush();

	}

	private static int solveC(int[] numA, int[] numB, int[] numC) {
		int count = 0;
		ansc = new StringBuilder("");
		t2Loop: while (true) {
			for (char cc : c) {
				if (numA[cc - 'a'] < numC[cc - 'a'])
					break t2Loop;
			}
			ansc.append(c);
			count++;
			for (char cc : c)
				numA[cc - 'a'] -= numC[cc - 'a'];
		}
		tLoop: while (true) {
			for (char bb : b) {
				if (numA[bb - 'a'] < numB[bb - 'a'])
					break tLoop;
			}
			ansc.append(b);
			count++;
			for (char bb : b)
				numA[bb - 'a'] -= numB[bb - 'a'];
		}
		for (int i = 0; i < numA.length; i++) {
			for (int j = 0; j < numA[i]; j++)
				ansc.append((char) (i + 'a'));
		}
		return count;
	}

	private static int solveB(int[] numA, int[] numB, int[] numC) {
		int count = 0;
		ansb = new StringBuilder("");
		tLoop: while (true) {
			for (char bb : b) {
				if (numA[bb - 'a'] < numB[bb - 'a'])
					break tLoop;
			}
			ansb.append(b);
			count++;
			for (char bb : b)
				numA[bb - 'a'] -= numB[bb - 'a'];
		}

		t2Loop: while (true) {
			for (char cc : c) {
				if (numA[cc - 'a'] < numC[cc - 'a'])
					break t2Loop;
			}
			ansb.append(c);
			count++;
			for (char cc : c)
				numA[cc - 'a'] -= numC[cc - 'a'];
		}
		for (int i = 0; i < numA.length; i++) {
			for (int j = 0; j < numA[i]; j++)
				ansb.append((char) (i + 'a'));
		}
		return count;
	}

}
