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 stoi(string x) {
  stringstream ss;
  ss << x;
  int tmp;
  ss >> tmp;
  return tmp;
}
string itos(int x) {
  stringstream ss;
  ss << x;
  return ss.str();
}
int cnt[26], cnt2[26], cnt3[26];
int main() {
  string a, b, c, ans = "", ans2 = "";
  int c1 = 0, c2 = 0;
  cin >> a >> b >> c;
  for (int i = 0; i < a.size(); i++) cnt[a[i] - 'a']++;
  for (int i = 0; i < b.size(); i++) cnt2[b[i] - 'a']++;
  for (int i = 0; i < c.size(); i++) cnt3[c[i] - 'a']++;
  bool ok = 1;
  for (int i = 0; i < 26; i++) {
    if (cnt[i] < cnt2[i]) {
      ok = 0;
    }
  }
  if (ok) {
    while (ok) {
      for (int i = 0; i < 26; i++) {
        if (cnt[i] < cnt2[i]) {
          ok = 0;
        }
      }
      if (!ok) break;
      for (int i = 0; i < 26; i++) cnt[i] -= cnt2[i];
      ans += b;
      c1++;
    }
  }
  ok = 1;
  while (ok) {
    for (int i = 0; i < 26; i++) {
      if (cnt[i] < cnt3[i]) {
        ok = 0;
      }
    }
    if (!ok) break;
    for (int i = 0; i < 26; i++) cnt[i] -= cnt3[i];
    ans += c;
    c1++;
  }
  for (int i = 0; i < 26; i++) {
    for (int k = 0; k < cnt[i]; k++) ans.push_back(i + 'a');
  }
  for (int i = 0; i < 26; i++) cnt[i] = cnt2[i] = cnt3[i] = 0;
  for (int i = 0; i < a.size(); i++) cnt[a[i] - 'a']++;
  for (int i = 0; i < b.size(); i++) cnt2[b[i] - 'a']++;
  for (int i = 0; i < c.size(); i++) cnt3[c[i] - 'a']++;
  ok = 1;
  for (int i = 0; i < 26; i++) {
    if (cnt[i] < cnt3[i]) {
      ok = 0;
    }
  }
  while (ok) {
    for (int i = 0; i < 26; i++) {
      if (cnt[i] < cnt3[i]) {
        ok = 0;
      }
    }
    if (!ok) break;
    for (int i = 0; i < 26; i++) cnt[i] -= cnt3[i];
    ans2 += c;
    c2++;
  }
  while (ok) {
    for (int i = 0; i < 26; i++) {
      if (cnt[i] < cnt2[i]) {
        ok = 0;
      }
    }
    if (!ok) break;
    for (int i = 0; i < 26; i++) cnt[i] -= cnt2[i];
    ans2 += b;
    c2++;
  }
  for (int i = 0; i < 26; i++) {
    for (int k = 0; k < cnt[i]; k++) ans2.push_back(i + 'a');
  }
  if (c1 > c2)
    cout << ans << endl;
  else
    cout << ans2 << endl;
  return 0;
}
