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

#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[100005], b[100005], c[100005], k[100005], l[100005], i, j;
  int cnta[26] = {0};
  cin >> a;
  cin >> b;
  cin >> c;
  for (i = 0; i < strlen(a); i++) cnta[a[i] - 'a']++;
  int flag1 = 0, flag2 = 0, cnt1 = 0, cnt2 = 0, x = 0, y = 0, tmp;
  while (!flag1) {
    for (i = 0; i < strlen(b); i++) {
      if (cnta[b[i] - 'a'] == 0) {
        flag1 = 1;
        tmp = i;
        break;
      } else
        cnta[b[i] - 'a']--;
    }
    if (!flag1) {
      for (i = 0; i < strlen(b); i++) {
        k[x++] = b[i];
      }
      cnt1++;
    } else {
      for (i = 0; i < tmp; i++) cnta[b[i] - 'a']++;
    }
  }
  while (!flag2) {
    for (i = 0; i < strlen(c); i++) {
      if (cnta[c[i] - 'a'] == 0) {
        flag2 = 1;
        tmp = i;
        break;
      } else
        cnta[c[i] - 'a']--;
    }
    if (!flag2) {
      for (i = 0; i < strlen(c); i++) {
        k[x++] = c[i];
      }
      cnt1++;
    } else {
      for (i = 0; i < tmp; i++) cnta[c[i] - 'a']++;
    }
  }
  for (i = 0; i < 26; i++) {
    if (cnta[i] != 0) {
      while (cnta[i] != 0) {
        k[x++] = char(i + 97);
        cnta[i]--;
      }
    }
  }
  k[x] = '\0';
  flag1 = 0;
  flag2 = 0;
  for (i = 0; i < strlen(a); i++) cnta[a[i] - 'a']++;
  while (!flag2) {
    for (i = 0; i < strlen(c); i++) {
      if (cnta[c[i] - 'a'] == 0) {
        flag2 = 1;
        tmp = i;
        break;
      } else
        cnta[c[i] - 'a']--;
    }
    if (!flag2) {
      for (i = 0; i < strlen(c); i++) {
        l[y++] = c[i];
      }
      cnt2++;
    } else {
      for (i = 0; i < tmp; i++) cnta[c[i] - 'a']++;
    }
  }
  while (!flag1) {
    for (i = 0; i < strlen(b); i++) {
      if (cnta[b[i] - 'a'] == 0) {
        flag1 = 1;
        tmp = i;
        break;
      } else
        cnta[b[i] - 'a']--;
    }
    if (!flag1) {
      for (i = 0; i < strlen(b); i++) {
        l[y++] = b[i];
      }
      cnt2++;
    } else {
      for (i = 0; i < tmp; i++) cnta[b[i] - 'a']++;
    }
  }
  for (i = 0; i < 26; i++) {
    if (cnta[i] != 0) {
      while (cnta[i] != 0) {
        l[y++] = char(i + 97);
        cnta[i]--;
      }
    }
  }
  l[y] = '\0';
  if (cnt1 < cnt2)
    cout << k;
  else
    cout << l;
  return 0;
}
