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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

/**
 * nisteaadddiiklooprrvz
 * nisteaaddiikloprrv
 * 
 * ´3`
 * */
public class B_Div2_307{
    public static void main(String[]arg) throws IOException
    {
        new B_Div2_307().solve();
    }
    public void solve() throws IOException
    {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String a = in.readLine();
        String b = in.readLine();
        String c = in.readLine();
        int[]nums = new int[26];
        int[]nb = new int[26];
        int[]nc = new int[26];
        int i,j;
        char car = 'a';
        for(i = 0; i < a.length(); i++)
        {
            car = a.charAt(i);
            nums[car-'a']++;
        }
        for(i = 0; i < b.length(); i++)
        {
            car = b.charAt(i);
            nb[car-'a']++;
        }
        for(i = 0; i < c.length(); i++)
        {
            car = c.charAt(i);
            nc[car-'a']++;
        }        
        
        StringBuffer bb = new StringBuffer();
        StringBuffer cc = new StringBuffer();
        
        boolean is = true;
        int cb = 0;
        int[]cnum = nums.clone();
        while(is)
        {
            for(i = 0; i < 26 && is; i++)
            {
                if(cnum[i] >= nb[i])
                {
                    cnum[i] -= nb[i];
                }
                else
                {
                    is = false;
                    for(j = 0; j < i; j++)
                        cnum[j] += nb[j];
                }
            }
            if(is)
            {
                bb.append(b);
                cb++;
            }
        }
        is = true;
        while(is)
        {
            for(i = 0; i < 26 && is; i++)
            {
                if(cnum[i] >= nc[i])
                {
                    cnum[i] -= nc[i];
                }
                else
                {
                    is = false;
                    for(j = 0; j < i; j++)
                        cnum[j] += nc[j];
                }
            }
            if(is)
            {
                bb.append(c);                
            }
        }
        for(car = 'a'; car <= 'z'; car++)
        {
            if(cnum[car-'a'] >0)
            {
                while(cnum[car-'a'] >0)
                {
                    bb.append(car);
                    cnum[car-'a']--;
                }
            }
        }
        /********************************************/
        
        is = true;
        int cd = 0;
        cnum = nums.clone();
        while(is)
        {
            for(i = 0; i < 26 && is; i++)
            {
                if(cnum[i] >= nc[i])
                {
                    cnum[i] -= nc[i];
                }
                else
                {
                    is = false;
                    for(j = 0; j < i; j++)
                        cnum[j] += nc[j];
                }
            }
            if(is)
            {
                cc.append(c);
                cd++;
            }
        }
        is = true;
        while(is)
        {
            for(i = 0; i < 26 && is; i++)
            {
                if(cnum[i] >= nb[i])
                {
                    cnum[i] -= nb[i];
                }
                else
                {
                    is = false;
                    for(j = 0; j < i; j++)
                        cnum[j] += nb[j];
                }
            }
            if(is)
            {
                cc.append(b);                
            }
        }
        for(car = 'a'; car <= 'z'; car++)
        {
            if(cnum[car-'a'] > 0)
            {
                while(cnum[car-'a'] > 0)
                {
                    cc.append(car);
                    cnum[car-'a']--;
                }
            }
        }
        
        if(cd >= cb)
        {
            System.out.println(cc);
        }
        else
            System.out.println(bb);
        
    }
}