/*numPass=1, numTotal=7
Verdict:ACCEPTED, Visibility:1, Input:"a", ExpOutput:"a
", Output:"a
"
Verdict:WRONG_ANSWER, Visibility:1, Input:"pqr", ExpOutput:"pqr
prq
qpr
qrp
rqp
rpq
", Output:""
Verdict:WRONG_ANSWER, Visibility:1, Input:"aceg", ExpOutput:"aceg
acge
aecg
aegc
agec
agce
caeg
cage
ceag
cega
cgea
cgae
ecag
ecga
eacg
eagc
egac
egca
gcea
gcae
geca
geac
gaec
gace
", Output:""
Verdict:WRONG_ANSWER, Visibility:1, Input:"fz", ExpOutput:"fz
zf
", Output:""
Verdict:WRONG_ANSWER, Visibility:0, Input:"abcdef", ExpOutput:"abcdef
abcdfe
abcedf
abcefd
abcfed
abcfde
abdcef
abdcfe
abdecf
abdefc
abdfec
abdfce
abedcf
abedfc
abecdf
abecfd
abefcd
abefdc
abfdec
abfdce
abfedc
abfecd
abfced
abfcde
acbdef
acbdfe
acbedf
acbefd
acbfed
acbfde
acdbef
acdbfe
acdebf
acdefb
acdfeb
acdfbe
acedbf
acedfb
acebdf
acebfd
acefbd
acefdb
acfdeb
acfdbe
acfedb
acfebd
acfbed
acfbde
adcbef
adcbfe
adcebf
adcefb
adcfeb
adcfbe
adbcef
adbcfe
adbecf
adbefc
adbfec
adbfce
adebcf
adebfc
adecbf
adecfb
adefcb
adefbc
adfbec
adfbce
adfebc
adfecb
adfceb
adfcbe
aecdbf
aecdfb
aecbdf
aecbfd
aecfbd
aecfdb
aedcbf
aedcfb
aedbcf
aedbfc
aedfbc
aedfcb
aebdcf
aebdfc
aebcdf
aebcfd
aebfcd
aebfdc
aefdbc
aefdcb
aefbdc
aefbcd
aefcbd
aefcdb
afcdeb
afcdbe
afcedb
afcebd
afcbed
afcbde
afdceb
afdcbe
afdecb
afdebc
afdbec
afdbce
afedcb
afedbc
afecdb
afecbd
afebcd
afebdc
afbdec
afbdce
afbedc
afbecd
afbced
afbcde
bacdef
bacdfe
bacedf
bacefd
bacfed
bacfde
badcef
badcfe
badecf
badefc
badfec
badfce
baedcf
baedfc
baecdf
baecfd
baefcd
baefdc
bafdec
bafdce
bafedc
bafecd
bafced
bafcde
bcadef
bcadfe
bcaedf
bcaefd
bcafed
bcafde
bcdaef
bcdafe
bcdeaf
bcdefa
bcdfea
bcdfae
bcedaf
bcedfa
bceadf
bceafd
bcefad
bcefda
bcfdea
bcfdae
bcfeda
bcfead
bcfaed
bcfade
bdcaef
bdcafe
bdceaf
bdcefa
bdcfea
bdcfae
bdacef
bdacfe
bdaecf
bdaefc
bdafec
bdafce
bdeacf
bdeafc
bdecaf
bdecfa
bdefca
bdefac
bdfaec
bdface
bdfeac
bdfeca
bdfcea
bdfcae
becdaf
becdfa
becadf
becafd
becfad
becfda
bedcaf
bedcfa
bedacf
bedafc
bedfac
bedfca
beadcf
beadfc
beacdf
beacfd
beafcd
beafdc
befdac
befdca
befadc
befacd
befcad
befcda
bfcdea
bfcdae
bfceda
bfcead
bfcaed
bfcade
bfdcea
bfdcae
bfdeca
bfdeac
bfdaec
bfdace
bfedca
bfedac
bfecda
bfecad
bfeacd
bfeadc
bfadec
bfadce
bfaedc
bfaecd
bfaced
bfacde
cbadef
cbadfe
cbaedf
cbaefd
cbafed
cbafde
cbdaef
cbdafe
cbdeaf
cbdefa
cbdfea
cbdfae
cbedaf
cbedfa
cbeadf
cbeafd
cbefad
cbefda
cbfdea
cbfdae
cbfeda
cbfead
cbfaed
cbfade
cabdef
cabdfe
cabedf
cabefd
cabfed
cabfde
cadbef
cadbfe
cadebf
cadefb
cadfeb
cadfbe
caedbf
caedfb
caebdf
caebfd
caefbd
caefdb
cafdeb
cafdbe
cafedb
cafebd
cafbed
cafbde
cdabef
cdabfe
cdaebf
cdaefb
cdafeb
cdafbe
cdbaef
cdbafe
cdbeaf
cdbefa
cdbfea
cdbfae
cdebaf
cdebfa
cdeabf
cdeafb
cdefab
cdefba
cdfbea
cdfbae
cdfeba
cdfeab
cdfaeb
cdfabe
ceadbf
ceadfb
ceabdf
ceabfd
ceafbd
ceafdb
cedabf
cedafb
cedbaf
cedbfa
cedfba
cedfab
cebdaf
cebdfa
cebadf
cebafd
cebfad
cebfda
cefdba
cefdab
cefbda
cefbad
cefabd
cefadb
cfadeb
cfadbe
cfaedb
cfaebd
cfabed
cfabde
cfdaeb
cfdabe
cfdeab
cfdeba
cfdbea
cfdbae
cfedab
cfedba
cfeadb
cfeabd
cfebad
cfebda
cfbdea
cfbdae
cfbeda
cfbead
cfbaed
cfbade
dbcaef
dbcafe
dbceaf
dbcefa
dbcfea
dbcfae
dbacef
dbacfe
dbaecf
dbaefc
dbafec
dbafce
dbeacf
dbeafc
dbecaf
dbecfa
dbefca
dbefac
dbfaec
dbface
dbfeac
dbfeca
dbfcea
dbfcae
dcbaef
dcbafe
dcbeaf
dcbefa
dcbfea
dcbfae
dcabef
dcabfe
dcaebf
dcaefb
dcafeb
dcafbe
dceabf
dceafb
dcebaf
dcebfa
dcefba
dcefab
dcfaeb
dcfabe
dcfeab
dcfeba
dcfbea
dcfbae
dacbef
dacbfe
dacebf
dacefb
dacfeb
dacfbe
dabcef
dabcfe
dabecf
dabefc
dabfec
dabfce
daebcf
daebfc
daecbf
daecfb
daefcb
daefbc
dafbec
dafbce
dafebc
dafecb
dafceb
dafcbe
decabf
decafb
decbaf
decbfa
decfba
decfab
deacbf
deacfb
deabcf
deabfc
deafbc
deafcb
debacf
debafc
debcaf
debcfa
debfca
debfac
defabc
defacb
defbac
defbca
defcba
defcab
dfcaeb
dfcabe
dfceab
dfceba
dfcbea
dfcbae
dfaceb
dfacbe
dfaecb
dfaebc
dfabec
dfabce
dfeacb
dfeabc
dfecab
dfecba
dfebca
dfebac
dfbaec
dfbace
dfbeac
dfbeca
dfbcea
dfbcae
ebcdaf
ebcdfa
ebcadf
ebcafd
ebcfad
ebcfda
ebdcaf
ebdcfa
ebdacf
ebdafc
ebdfac
ebdfca
ebadcf
ebadfc
ebacdf
ebacfd
ebafcd
ebafdc
ebfdac
ebfdca
ebfadc
ebfacd
ebfcad
ebfcda
ecbdaf
ecbdfa
ecbadf
ecbafd
ecbfad
ecbfda
ecdbaf
ecdbfa
ecdabf
ecdafb
ecdfab
ecdfba
ecadbf
ecadfb
ecabdf
ecabfd
ecafbd
ecafdb
ecfdab
ecfdba
ecfadb
ecfabd
ecfbad
ecfbda
edcbaf
edcbfa
edcabf
edcafb
edcfab
edcfba
edbcaf
edbcfa
edbacf
edbafc
edbfac
edbfca
edabcf
edabfc
edacbf
edacfb
edafcb
edafbc
edfbac
edfbca
edfabc
edfacb
edfcab
edfcba
eacdbf
eacdfb
eacbdf
eacbfd
eacfbd
eacfdb
eadcbf
eadcfb
eadbcf
eadbfc
eadfbc
eadfcb
eabdcf
eabdfc
eabcdf
eabcfd
eabfcd
eabfdc
eafdbc
eafdcb
eafbdc
eafbcd
eafcbd
eafcdb
efcdab
efcdba
efcadb
efcabd
efcbad
efcbda
efdcab
efdcba
efdacb
efdabc
efdbac
efdbca
efadcb
efadbc
efacdb
efacbd
efabcd
efabdc
efbdac
efbdca
efbadc
efbacd
efbcad
efbcda
fbcdea
fbcdae
fbceda
fbcead
fbcaed
fbcade
fbdcea
fbdcae
fbdeca
fbdeac
fbdaec
fbdace
fbedca
fbedac
fbecda
fbecad
fbeacd
fbeadc
fbadec
fbadce
fbaedc
fbaecd
fbaced
fbacde
fcbdea
fcbdae
fcbeda
fcbead
fcbaed
fcbade
fcdbea
fcdbae
fcdeba
fcdeab
fcdaeb
fcdabe
fcedba
fcedab
fcebda
fcebad
fceabd
fceadb
fcadeb
fcadbe
fcaedb
fcaebd
fcabed
fcabde
fdcbea
fdcbae
fdceba
fdceab
fdcaeb
fdcabe
fdbcea
fdbcae
fdbeca
fdbeac
fdbaec
fdbace
fdebca
fdebac
fdecba
fdecab
fdeacb
fdeabc
fdabec
fdabce
fdaebc
fdaecb
fdaceb
fdacbe
fecdba
fecdab
fecbda
fecbad
fecabd
fecadb
fedcba
fedcab
fedbca
fedbac
fedabc
fedacb
febdca
febdac
febcda
febcad
febacd
febadc
feadbc
feadcb
feabdc
feabcd
feacbd
feacdb
facdeb
facdbe
facedb
facebd
facbed
facbde
fadceb
fadcbe
fadecb
fadebc
fadbec
fadbce
faedcb
faedbc
faecdb
faecbd
faebcd
faebdc
fabdec
fabdce
fabedc
fabecd
fabced
fabcde
", Output:""
Verdict:WRONG_ANSWER, Visibility:0, Input:"defg", ExpOutput:"defg
degf
dfeg
dfge
dgfe
dgef
edfg
edgf
efdg
efgd
egfd
egdf
fedg
fegd
fdeg
fdge
fgde
fged
gefd
gedf
gfed
gfde
gdfe
gdef
", Output:""
Verdict:WRONG_ANSWER, Visibility:0, Input:"eqrtwy", ExpOutput:"eqrtwy
eqrtyw
eqrwty
eqrwyt
eqrywt
eqrytw
eqtrwy
eqtryw
eqtwry
eqtwyr
eqtywr
eqtyrw
eqwtry
eqwtyr
eqwrty
eqwryt
eqwyrt
eqwytr
eqytwr
eqytrw
eqywtr
eqywrt
eqyrwt
eqyrtw
erqtwy
erqtyw
erqwty
erqwyt
erqywt
erqytw
ertqwy
ertqyw
ertwqy
ertwyq
ertywq
ertyqw
erwtqy
erwtyq
erwqty
erwqyt
erwyqt
erwytq
erytwq
erytqw
erywtq
erywqt
eryqwt
eryqtw
etrqwy
etrqyw
etrwqy
etrwyq
etrywq
etryqw
etqrwy
etqryw
etqwry
etqwyr
etqywr
etqyrw
etwqry
etwqyr
etwrqy
etwryq
etwyrq
etwyqr
etyqwr
etyqrw
etywqr
etywrq
etyrwq
etyrqw
ewrtqy
ewrtyq
ewrqty
ewrqyt
ewryqt
ewrytq
ewtrqy
ewtryq
ewtqry
ewtqyr
ewtyqr
ewtyrq
ewqtry
ewqtyr
ewqrty
ewqryt
ewqyrt
ewqytr
ewytqr
ewytrq
ewyqtr
ewyqrt
ewyrqt
ewyrtq
eyrtwq
eyrtqw
eyrwtq
eyrwqt
eyrqwt
eyrqtw
eytrwq
eytrqw
eytwrq
eytwqr
eytqwr
eytqrw
eywtrq
eywtqr
eywrtq
eywrqt
eywqrt
eywqtr
eyqtwr
eyqtrw
eyqwtr
eyqwrt
eyqrwt
eyqrtw
qertwy
qertyw
qerwty
qerwyt
qerywt
qerytw
qetrwy
qetryw
qetwry
qetwyr
qetywr
qetyrw
qewtry
qewtyr
qewrty
qewryt
qewyrt
qewytr
qeytwr
qeytrw
qeywtr
qeywrt
qeyrwt
qeyrtw
qretwy
qretyw
qrewty
qrewyt
qreywt
qreytw
qrtewy
qrteyw
qrtwey
qrtwye
qrtywe
qrtyew
qrwtey
qrwtye
qrwety
qrweyt
qrwyet
qrwyte
qrytwe
qrytew
qrywte
qrywet
qryewt
qryetw
qtrewy
qtreyw
qtrwey
qtrwye
qtrywe
qtryew
qterwy
qteryw
qtewry
qtewyr
qteywr
qteyrw
qtwery
qtweyr
qtwrey
qtwrye
qtwyre
qtwyer
qtyewr
qtyerw
qtywer
qtywre
qtyrwe
qtyrew
qwrtey
qwrtye
qwrety
qwreyt
qwryet
qwryte
qwtrey
qwtrye
qwtery
qwteyr
qwtyer
qwtyre
qwetry
qwetyr
qwerty
qweryt
qweyrt
qweytr
qwyter
qwytre
qwyetr
qwyert
qwyret
qwyrte
qyrtwe
qyrtew
qyrwte
qyrwet
qyrewt
qyretw
qytrwe
qytrew
qytwre
qytwer
qytewr
qyterw
qywtre
qywter
qywrte
qywret
qywert
qywetr
qyetwr
qyetrw
qyewtr
qyewrt
qyerwt
qyertw
rqetwy
rqetyw
rqewty
rqewyt
rqeywt
rqeytw
rqtewy
rqteyw
rqtwey
rqtwye
rqtywe
rqtyew
rqwtey
rqwtye
rqwety
rqweyt
rqwyet
rqwyte
rqytwe
rqytew
rqywte
rqywet
rqyewt
rqyetw
reqtwy
reqtyw
reqwty
reqwyt
reqywt
reqytw
retqwy
retqyw
retwqy
retwyq
retywq
retyqw
rewtqy
rewtyq
rewqty
rewqyt
rewyqt
rewytq
reytwq
reytqw
reywtq
reywqt
reyqwt
reyqtw
rteqwy
rteqyw
rtewqy
rtewyq
rteywq
rteyqw
rtqewy
rtqeyw
rtqwey
rtqwye
rtqywe
rtqyew
rtwqey
rtwqye
rtweqy
rtweyq
rtwyeq
rtwyqe
rtyqwe
rtyqew
rtywqe
rtyweq
rtyewq
rtyeqw
rwetqy
rwetyq
rweqty
rweqyt
rweyqt
rweytq
rwteqy
rwteyq
rwtqey
rwtqye
rwtyqe
rwtyeq
rwqtey
rwqtye
rwqety
rwqeyt
rwqyet
rwqyte
rwytqe
rwyteq
rwyqte
rwyqet
rwyeqt
rwyetq
ryetwq
ryetqw
ryewtq
ryewqt
ryeqwt
ryeqtw
rytewq
ryteqw
rytweq
rytwqe
rytqwe
rytqew
rywteq
rywtqe
rywetq
ryweqt
rywqet
rywqte
ryqtwe
ryqtew
ryqwte
ryqwet
ryqewt
ryqetw
tqrewy
tqreyw
tqrwey
tqrwye
tqrywe
tqryew
tqerwy
tqeryw
tqewry
tqewyr
tqeywr
tqeyrw
tqwery
tqweyr
tqwrey
tqwrye
tqwyre
tqwyer
tqyewr
tqyerw
tqywer
tqywre
tqyrwe
tqyrew
trqewy
trqeyw
trqwey
trqwye
trqywe
trqyew
treqwy
treqyw
trewqy
trewyq
treywq
treyqw
trweqy
trweyq
trwqey
trwqye
trwyqe
trwyeq
tryewq
tryeqw
tryweq
trywqe
tryqwe
tryqew
terqwy
terqyw
terwqy
terwyq
terywq
teryqw
teqrwy
teqryw
teqwry
teqwyr
teqywr
teqyrw
tewqry
tewqyr
tewrqy
tewryq
tewyrq
tewyqr
teyqwr
teyqrw
teywqr
teywrq
teyrwq
teyrqw
twreqy
twreyq
twrqey
twrqye
twryqe
twryeq
twerqy
tweryq
tweqry
tweqyr
tweyqr
tweyrq
twqery
twqeyr
twqrey
twqrye
twqyre
twqyer
twyeqr
twyerq
twyqer
twyqre
twyrqe
twyreq
tyrewq
tyreqw
tyrweq
tyrwqe
tyrqwe
tyrqew
tyerwq
tyerqw
tyewrq
tyewqr
tyeqwr
tyeqrw
tywerq
tyweqr
tywreq
tywrqe
tywqre
tywqer
tyqewr
tyqerw
tyqwer
tyqwre
tyqrwe
tyqrew
wqrtey
wqrtye
wqrety
wqreyt
wqryet
wqryte
wqtrey
wqtrye
wqtery
wqteyr
wqtyer
wqtyre
wqetry
wqetyr
wqerty
wqeryt
wqeyrt
wqeytr
wqyter
wqytre
wqyetr
wqyert
wqyret
wqyrte
wrqtey
wrqtye
wrqety
wrqeyt
wrqyet
wrqyte
wrtqey
wrtqye
wrteqy
wrteyq
wrtyeq
wrtyqe
wretqy
wretyq
wreqty
wreqyt
wreyqt
wreytq
wryteq
wrytqe
wryetq
wryeqt
wryqet
wryqte
wtrqey
wtrqye
wtreqy
wtreyq
wtryeq
wtryqe
wtqrey
wtqrye
wtqery
wtqeyr
wtqyer
wtqyre
wteqry
wteqyr
wterqy
wteryq
wteyrq
wteyqr
wtyqer
wtyqre
wtyeqr
wtyerq
wtyreq
wtyrqe
wertqy
wertyq
werqty
werqyt
weryqt
werytq
wetrqy
wetryq
wetqry
wetqyr
wetyqr
wetyrq
weqtry
weqtyr
weqrty
weqryt
weqyrt
weqytr
weytqr
weytrq
weyqtr
weyqrt
weyrqt
weyrtq
wyrteq
wyrtqe
wyretq
wyreqt
wyrqet
wyrqte
wytreq
wytrqe
wyterq
wyteqr
wytqer
wytqre
wyetrq
wyetqr
wyertq
wyerqt
wyeqrt
wyeqtr
wyqter
wyqtre
wyqetr
wyqert
wyqret
wyqrte
yqrtwe
yqrtew
yqrwte
yqrwet
yqrewt
yqretw
yqtrwe
yqtrew
yqtwre
yqtwer
yqtewr
yqterw
yqwtre
yqwter
yqwrte
yqwret
yqwert
yqwetr
yqetwr
yqetrw
yqewtr
yqewrt
yqerwt
yqertw
yrqtwe
yrqtew
yrqwte
yrqwet
yrqewt
yrqetw
yrtqwe
yrtqew
yrtwqe
yrtweq
yrtewq
yrteqw
yrwtqe
yrwteq
yrwqte
yrwqet
yrweqt
yrwetq
yretwq
yretqw
yrewtq
yrewqt
yreqwt
yreqtw
ytrqwe
ytrqew
ytrwqe
ytrweq
ytrewq
ytreqw
ytqrwe
ytqrew
ytqwre
ytqwer
ytqewr
ytqerw
ytwqre
ytwqer
ytwrqe
ytwreq
ytwerq
ytweqr
yteqwr
yteqrw
ytewqr
ytewrq
yterwq
yterqw
ywrtqe
ywrteq
ywrqte
ywrqet
ywreqt
ywretq
ywtrqe
ywtreq
ywtqre
ywtqer
ywteqr
ywterq
ywqtre
ywqter
ywqrte
ywqret
ywqert
ywqetr
ywetqr
ywetrq
yweqtr
yweqrt
ywerqt
ywertq
yertwq
yertqw
yerwtq
yerwqt
yerqwt
yerqtw
yetrwq
yetrqw
yetwrq
yetwqr
yetqwr
yetqrw
yewtrq
yewtqr
yewrtq
yewrqt
yewqrt
yewqtr
yeqtwr
yeqtrw
yeqwtr
yeqwrt
yeqrwt
yeqrtw
", Output:""
*/
#include <stdio.h>
#include <string.h>

void swap(char*n,char* i)
{
    char c;
    c=*n;
    *n=*i;
    *i=c;
}
void per(char str[],int n,int l)
{
    int i;
    if(n==l)
    printf("%s\n",str);
    else
    {
         for(i=n;i<=l;i++)
         {
             swap(str[n],str[i]);
             per(str,n+1,l);
             swap(str[n],str[i]);
         }
    }
    
    
    
}
int main()
{
    char str[100];
int i,x=1,n=0,l;
scanf("%s",str);
l=strlen(str);
for(i=1;i<=l;i++)
x=x*i;
per(str,n,l-1);
    return 0;
}