Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

python ***This is the stuff inide the word.txt file*** 10th 1st 2nd 3rd 4th 5th

ID: 3802458 • Letter: P

Question

python

***This is the stuff inide the word.txt file***

10th
1st
2nd
3rd
4th
5th
6th
7th
8th
9th
a
a&m
a&p
a's
aaa
aaas
aau
aba
abbe
abc
abe
abed
abel
abet
able
abo
abut
ac
ace
ache
acid
acm
acme
acre
acs
act
acts
ad
ada
adam
add
aden
ado
afar
afro
aft
age
agee
ago
ague
ah
ahem
ahoy
aid
aida
aide
ail
aile
aim
ainu
air
airy
ajar
ajax
ak
akin
al
ala
alai
alan
alb
alba
ale
alec
alex
alga
ali
alia
all
ally
alma
aloe
alp
alps
also
alto
alum
alva
am
ama
amen
ames
ami
amid
ammo
amok
amos
amp
amra
amy
an
ana
and
andy
anew
ani
ann
anna
anne
ansi
ant
ante
anti
any
ape
apex
apr
aps
apse
apt
aqua
ar
arab
arc
arch
are
area
ares
argo
arid
ark
arm
army
arpa
art
arty
arum
aryl
as
ash
ashy
asia
ask
ass
astm
at
at&t
ate
atom
atop
aug
auk
aunt
aura
auto
ave
aver
avid
avis
aviv
avon
avow
away
awe
awl
awn
awry
ax
axe
axes
axis
axle
axon
aye
az
b
b's
babe
baby
bach
back
bad
bade
bag
bah
bail
bait
bake
baku
bald
bale
bali
balk
ball
balm
bam
ban
band
bane
bang
bank
bar
barb
bard
bare
bark
barn
barr
bart
base
bash
bask
bass
bat
bate
bath
batt
baud
bawd
bawl
bay
be
bead
beak
beam
bean
bear
beat
beau
beck
bed
bee
beef
been
beep
beer
beet
beg
bel
bela
bell
belt
bema
ben
bend
bent
benz
berg
bern
bert
bess
best
bet
beta
beth
bevy
bey
bhoy
bias
bib
bibb
bid
bide
bien
big
bike
bile
bilk
bill
bin
bind
bing
bini
bird
bit
bite
bitt
biz
blab
blat
bled
blew
blip
blob
bloc
blot
blow
blue
blum
blur
blvd
bmw
boa
boar
boat
bob
boca
bock
bode
body
bog
bogy
bohr
boil
bois
bold
bole
bolo
bolt
bomb
bon
bona
bond
bone
bong
bonn
bony
boo
book
boom
boon
boor
boot
bop
bore
borg
born
bose
boss
both
bout
bow
bowl
box
boxy
boy
boyd
bp
brad
brae
brag
bran
bray
bred
brew
brig
brim
brow
bryn
bstj
btl
btu
bub
buck
bud
budd
buff
bug
bulb
bulk
bull
bum
bump
bun
bunk
bunt
buoy
burg
burl
burn
burp
burr
burt
bury
bus
bush
buss
bust
busy
but
butt
buy
buzz
by
bye
byrd
byte
c
c's
ca
cab
cacm
cady
cafe
cage
cain
cake
cal
calf
call
calm
cam
came
camp
can
cane
cant
cap
cape
capo
car
card
care
carl
carp
carr
cart
case
cash
cask
cast
cat
catv
cave
caw
cb
cbs
ccny
cdc
cede
ceil
cell
cent
ceq
cern
cf
chad
chao
chap
char
chat
chaw
chef
chen
chew
chi
chic
chin
chip
chit
chop
chou
chow
chub
chug
chum
cia
cit
cite
city
clad
clam
clan
clap
claw
clay
clio
clip
clod
clog
clot
cloy
club
clue
cluj
co
coal
coat
coax
cobb
coca
cock
coco
cod
coda
code
cody
coed
cog
cohn
coil
coin
coke
col
cola
cold
cole
colt
coma
comb
come
con
cone
conn
cony
coo
cook
cool
coon
coop
coot
cop
cope
copy
cord
core
cork
corn
corp
cos
cosh
cost
cosy
cot
coup
cove
cow
cowl
cox
coy
cozy
cpa
cpu
crab
crag
cram
craw
crew
crib
crop
crow
crt
crud
crux
cruz
cry
ct
cub
cuba
cube
cud
cue
cuff
cull
cult
cuny
cup
cur
curb
curd
cure
curl
curt
cusp
cut
cute
cyst
cz
czar
d
d's
dab
dad
dada
dade
dahl
dais
dale
daly
dam
dame
damp
dan
dana
dane
dang
dank
dar
dare
dark
darn
dart
dash
data
date
daub
dave
davy
dawn
day
daze
dc
de
dead
deaf
deal
dean
dear
debt
dec
deck
dee
deed
deem
deep
deer
deft
defy
deja
del
dell
demo
den
dent
deny
des
desk
deus
dew
dewy
dey
dial
dice
dick
did
dido
die
died
diem
diet
dig
dill
dim
dime
din
dine
ding
dint
dip
dire
dirt
dis
disc
dish
disk
diva
dive
dna
do
dock
dod
dodd
dodo
doe
doff
dog
doge
dole
doll
dolt
dome
don
done
doom
door
dope
dora
dose
dot
dote
doug
dour
dove
dow
down
doze
dr
drab
drag
dram
draw
dreg
drew
drib
drip
drop
drub
drug
drum
dry
du
dual
dub
duck
duct
dud
due
duel
duet
duff
dug
duke
dull
duly
duma
dumb
dump
dun
dune
dung
dunk
dunn
dupe
dusk
dust
duty
dyad
dye
dyer
dyne
e
e'er
e's
e.g
each
ear
earl
earn
ease
east
easy
eat
eave
ebb
eben
echo
ed
eddy
eden
edge
edgy
edit
edna
edt
eel
eeoc
eft
egan
egg
ego
eh
eire
eke
el
elan
elba
eli
elk
ell
ella
elm
else
ely
em
emil
emit
emma
en
end
eng
enid
enol
enos
envy
epa
epic
era
erda
ere
erg
eric
erie
erik
eros
err
est
et
eta
etc
etch
eva
eve
even
evil
ewe
ex
exam
exit
eye
eyed
ezra
f
f's
faa
face
fact
fad
fade
fail
fain
fair
fake
fall
fame
fan
fang
far
fare
farm
faro
fast
fat
fate
faun
fawn
fay
faze
fbi
fcc
fda
fe
fear
feat
feb
fed
fee
feed
feel
feet
fell
felt
fend
fern
fest
fete
feud
few
fiat
fib
fide
fief
fife
fifo
fig
file
fill
film
fin
find
fine
fink
finn
fir
fire
firm
fish
fisk
fist
fit
five
fix
fl
flag
flak
flam
flap
flat
flaw
flax
flea
fled
flee
flew
flex
flip
flit
flo
floc
floe
flog
flop
flow
flu
flub
flue
flux
fly
fm
fmc
foal
foam
fob
foci
foe
fog
fogy
foil
fold
folk
fond
font
food
fool
foot
fop
for
ford
fore
fork
form
fort
foss
foul
four
fowl
fox
foxy
fpc
fran
frau
fray
fred
free
fret
frey
fro
frog
from
fry
frye
ft
ftc
fuel
fuji
full
fum
fume
fun
fund
funk
fur
furl
fury
fuse
fuss
fuzz
g
g's
ga
gab
gad
gaff
gag
gage
gail
gain
gait
gal
gala
gale
gall
galt
gam
game
gang
gao
gap
gape
gar
garb
gary
gas
gash
gasp
gate
gaul
gaur
gave
gawk
gaze
ge
gear
gee
gel
geld
gem
gene
gent
germ
get
gibe
gift
gig
gil
gila
gild
gill
gilt
gin
gina
ginn
gino
gird
girl
gist
give
glad
glee
glen
glib
glob
glom
glow
glue
glum
glut
gm
gmt
gnat
gnaw
gnp
gnu
go
goa
goad
goal
goat
gob
god
goer
goes
goff
gog
gogh
gogo
gold
golf
gone
gong
good
goof
gop
gore
gory
gosh
got
gout
gown
gpo
grab
grad
gray
greg
grew
grey
grid
grim
grin
grip
grit
grow
grub
gsa
gu
guam
gulf
gull
gulp
gum
gun
gunk
guru
gus
gush
gust
gut
guy
gwen
gwyn
gym
gyp
gyro
h
h's
ha
haag
haas
hack
had
hahn
hail
hair
hal
hale
half
hall
halo
halt
ham
han
hand
hang
hank
hans
hap
hard
hare
hark
harm
harp
hart
hash
hasp
hast
hat
hate
hath
haul
have
haw
hawk
hay
hays
haze
hazy
he
he'd
head
heal
heap
hear
heat
hebe
heck
heed
heel
heft
heir
held
hell
helm
help
hem
hemp
hen
her
hera
herb
herd
here
hero
herr
hess
hew
hewn
hex
hey
hi
hick
hid
hide
high
hike
hill
hilt
him
hind
hint
hip
hire
his
hiss
hit
hive
ho
hoar
hob
hobo
hoc
hock
hoe
hoff
hog
hoi
hold
hole
holm
holt
hom
home
homo
hone
hong
honk
hood
hoof
hook
hoop
hoot
hop
hope
horn
hose
host
hot
hour
hove
how
howe
howl
hoy
hoyt
hub
huck
hue
hued
huff
hug
huge
hugh
hugo
huh
hulk
hull
hum
hump
hun
hung
hunk
hunt
hurd
hurl
hurt
hush
hut
hyde
hymn
i
i'd
i'll
i'm
i's
i've
i.e
ia
ian
ibex
ibid
ibis
ibm
ibn
icc
ice
icky
icon
icy
id
ida
idea
idle
idol
ieee
if
iffy
ifni
igor
ii
iii
ike
il
ill
imp
in
inc
inca
inch
indy
info
ink
inn
into
io
ion
iota
iowa
ipso
iq
ir
ira
iran
iraq
ire
iris
irk
irma
iron
irs
is
isis
isle
it
it&t
it'd
itch
item
ito
itt
iv
ivan
ivy
ix
j
j's
jab
jack
jacm
jade
jag
jail
jake
jam
jan
jane
jar
java
jaw
jay
jazz
jean
jed
jeep
jeff
jerk
jess
jest
jet
jew
jibe
jig
jill
jilt
jim
jinx
jive
jo
joan
job
jock
joe
joel
joey
jog
john
join
joke
jolt
jon
jose
joss
jot
jove
jowl
joy
jr
juan
judd
jude
judo
judy
jug
juju
juke
july
jump
june
junk
juno
jura
jure
jury
just
jut
jute
k
k's
kahn
kale
kane
kant
karl
karp
kate
katz
kava
kay
kayo
keel
keen
keep
keg
kelp
kemp
ken
keno
kent
kept
kern
kerr
key
keys
khan
kick
kid
kiev
kill
kilo
kim
kin
kind
king
kink
kirk
kiss
kit
kite
kiva
kivu
kiwi
klan
klux
knee
knew
knit
knob
knot
know
knox
koch
kola
kong
ks
ku
kudo
kuhn
kurd
kurt
ky
kyle
l
l's
la
lab
lac
lace
lack
lacy
lad
lady
lag
laid
lain
lair
lake
lam
lamb
lame
lamp
lana
land
lane
lang
lank
lao
laos
lap
lard
lark
lars
lase
lash
lass
last
late
lath
laud
laue
lava
law
lawn
lax
lay
laze
lazy
lea
lead
leaf
leak
lean
leap
lear
led
lee
leek
leer
left
leg
len
lena
lend
lens
lent
leo
leon
less
lest
let
lev
levi
levy
lew
lewd
liar
lice
lick
lid
lie
lied
lien
lieu
life
lifo
lift
like
lila
lilt
lily
lim
lima
limb
lime
limp
lin
lind
line
link
lint
lion
lip
lisa
lise
lisp
list
lit
live
liz
lo
load
loaf
loam
loan
lob
lobe
lobo
loci
lock
loeb
loft
log
loge
logo
loin
lois
loki
lola
loll
lomb
lome
lone
long
look
loom
loon
loop
loot
lop
lope
lord
lore
los
lose
loss
lost
lot
lou
loud
love
low
lowe
loy
lsi
ltd
ltv
luck
lucy
lug
luge
luis
luke
lull
lulu
lump
lund
lung
lura
lure
lurk
lush
lust
lute
lutz
lux
luxe
lye
lyle
lynn
lynx
lyon
lyra
m
m's
ma
mac
mace
mach
mack
mad
made
mae
magi
maid
mail
maim
main
make
male
mali
mall
malt
man
mana
mane
mann
mans
many
mao
map
mar
marc
mare
mark
mars
mart
marx
mary
mash
mask
mass
mast
mat
mate
math
maul
maw
mawr
max
may
maya
mayo
maze
mba
md
me
mead
meal
mean
meat
meek
meet
meg
mel
meld
melt
memo
men
mend
menu
mere
mesa
mesh
mess
met
mete
mew
mi
mica
mice
mid
mien
miff
mig
mike
mila
mild
mile
milk
mill
milt
mimi
min
mind
mine
mini
mink
mint
mira
mire
miss
mist
mit
mite
mitt
mix
mn
mo
moan
moat
mob
mock
mode
moe
moen
mohr
mold
mole
moll
molt
mona
monk
mont
moo
mood
moon
moor
moot
mop
more
morn
mort
moss
most
mot
moth
move
mow
mph
mr
mrs
ms
mt
mu
much
muck
mud
mudd
muff
mug
muir
mule
mull
mum
mung
muon
murk
muse
mush
musk
must
mute
mutt
muzo
my
myel
myra
myth
n
n's
nab
nag
nagy
nail
nair
name
nan
nap
nape
nary
nasa
nash
nat
nate
nato
nave
navy
nay
nazi
nbc
nbs
nc
ncaa
ncar
nco
ncr
nd
ne
neal
neap
near
neat
neck
ned
nee
need
neff
neil
nell
neon
nero
ness
nest
net
neva
neve
new
newt
next
nh
nib
nibs
nice
nick
nigh
nih
nil
nile
nimh
nina
nine
nip
nit
nj
nm
nne
nnw
no
noaa
noah
nob
nod
node
noel
noll
nolo
non
none
nook
noon
nor
nora
norm
nose
not
note
noun
nov
nova
novo
now
nrc
nsf
ntis
nu
nude
null
numb
nun
nut
nv
nw
ny
nyc
nyu
o
o'er
o's
oaf
oak
oar
oat
oath
obey
oboe
oct
odd
ode
odin
of
off
oft
ogle
ogre
oh
ohio
ohm
oil
oily
oint
ok
okay
olaf
olav
old
oldy
olga
olin
oman
omen
omit
on
once
one
only
onto
onus
onyx
ooze
opal
opec
opel
open
opt
opus
or
oral
orb
ore
orgy
orin
orr
osha
oslo
otis
ott
otto
ouch
our
oust
out
ouzo
ova
oval
oven
over
ovid
ovum
ow
owe
owl
owly
own
ox
oxen
p
p's
pa
pace
pack
pact
pad
page
paid
pail
pain
pair
pal
pale
pall
palm
palo
pam
pan
pane
pang
pant
pap
papa
par
pare
park
parr
part
paso
pass
past
pat
pate
path
paul
pave
paw
pawn
pax
pay
paz
pbs
pdp
pea
peak
peal
pear
peat
peck
pee
peed
peek
peel
peep
peer
peg
pelt
pen
pend
penh
penn
pent
pep
per
perk
pert
peru
pest
pet
pete
pew
ph.d
phd
phi
phil
phon
pi
pica
pick
pie
pier
pig
pike
pile
pill
pimp
pin
pine
ping
pink
pint
pion
pip
pipe
piss
pit
pith
pitt
pity
pius
pixy
pl
plan
plat
play
plea
plod
plop
plot
plug
plum
plus
ply
pm
po
pod
poe
poem
poet
pogo
poi
poke
pol
pole
polk
poll
polo
pomp
pond
pong
pont
pony
pooh
pool
poop
poor
pop
pope
pore
pork
port
pose
posh
post
posy
pot
pour
pout
pow
ppm
pr
pram
pray
prep
prey
prig
prim
pro
prod
prof
prom
prop
prow
pry
psi
pta
pub
puc
puck
puff
pug
pugh
puke
pull
pulp
puma
pump
pun
punk
punt
puny
pup
pure
purl
purr
pus
push
put
putt
pvc
pyle
pyre
q
q's
qed
qua
quad
quay
quid
quip
quit
quiz
quo
quod
r
r&d
r's
race
rack
racy
rae
raft
rag
rage
raid
rail
rain
raj
rake
ram
ramo
ramp
ran
rand
rang
rank
rant
rap
rape
rapt
rare
rasa
rash
rasp
rat
rata
rate
raul
rave
raw
ray
raze
rca
rd
re
read
real
ream
reap
rear
reb
reck
red
reed
reef
reek
reel
reid
rein
rena
rend
rene
rent
rep
rest
ret
reub
rev
rex
rhea
rho
ri
rib
rica
rice
rich
rick
rico
rid
ride
rift
rig
riga
rill
rim
rime
rimy
ring
rink
rio
riot
rip
ripe
rise
risk
rite
ritz
rna
road
roam
roar
rob
robe
rock
rod
rode
roe
roil
role
roll
rome
romp
ron
rood
roof
rook
room
root
rope
rosa
rose
ross
rosy
rot
rotc
rote
roth
rout
rove
row
rowe
roy
rpm
rsvp
rub
rube
ruby
rude
rudy
rue
ruff
rug
ruin
rule
rum
rump
run
rune
rung
runt
ruse
rush
rusk
russ
rust
rut
ruth
ryan
rye
s
s's
sa
sac
sack
sad
safe
sag
saga
sage
sago
said
sail
sake
sal
sale
salk
salt
sam
same
san
sana
sand
sane
sang
sank
sans
sao
sap
sara
sari
sash
sat
saud
saul
save
saw
sax
say
sc
scab
scam
scan
scar
scat
sci
scm
scot
scud
scum
sd
se
sea
seal
seam
sean
sear
seat
sec
sect
see
seed
seek
seem
seen
seep
self
sell
semi
sen
send
sent
sept
seq
sera
serf
set
seth
sew
sewn
sex
sexy
shad
shag
shah
sham
shaw
shay
she
shea
shed
shim
shin
ship
shiv
shod
shoe
shoo
shop
shot
show
shu
shun
shut
shy
sial
siam
sian
sib
sic
sick
side
sift
sigh
sign
silk
sill
silo
silt
sima
sims
sin
sine
sing
sinh
sink
sip
sir
sire
sis
sit
site
situ
siva
six
size
skat
skew
ski
skid
skim
skin
skip
skit
sky
skye
slab
slag
slam
slap
slat
slav
slay
sled
slew
slid
slim
slip
slit
slob
sloe
slog
slop
slot
slow
slug
slum
slur
sly
smog
smug
smut
snag
snap
snip
snob
snow
snub
snug
so
soak
soap
soar
sob
soc
sock
sod
soda
sofa
soft
soil
sol
sold
sole
solo
soma
some
son
song
sony
soon
soot
sop
sora
sorb
sore
sort
sou
soul
soup
sour
sow
sown
soy
soya
spa
span
spar
spat
spay
spec
sped
spew
spin
spit
spot
spud
spun
spur
spy
sri
sse
sst
ssw
st
stab
stag
stan
star
stay
stem
step
stew
stir
stop
stow
stu
stub
stud
stun
styx
sub
such
suck
sud
suds
sue
suey
suez
suit
sulk
sum
sun
sung
sunk
suny
sup
sure
surf
sus
sw
swab
swag
swam
swan
swap
swat
sway
swig
swim
swum
t
t's
ta
tab
tabu
tack
tact
tad
taft
tag
tail
take
talc
tale
talk
tall
tam
tame
tamp
tan
tang
tanh
tank
tao
taos
tap
tapa
tape
tar
tara
tart
task
tass
tat
tate
tau
taut
tax
taxi
tea
teal
team
tear
teat
tech
ted
tee
teem
teen
teet
tel
tell
ten
tend
tent
term
tern
tess
test
tete
text
thai
than
that
thaw
the
thea
thee
them
then
they
thin
this
thor
thou
thud
thug
thus
thy
ti
tic
tick
tid
tide
tidy
tie
tied
tier
tift
til
tile
till
tilt
tim
time
tin
tina
tine
tint
tiny
tip
tire
tit
tn
tnt
to
toad
toby
todd
toe
tofu
tog
togo
togs
toil
told
toll
tom
tomb
tome
ton
tone
tong
toni
tonk
tony
too
took
tool
toot
top
tor
tore
tori
torn
torr
tort
tory
toss
tot
tote
tour
tout
tow
town
toy
trag
tram
trap
tray
tree
trek
trig
trim
trio
trip
trod
trot
troy
true
trw
try
tsar
ttl
tty
tub
tuba
tube
tuck
tuff
tuft
tug
tum
tun
tuna
tune
tung
turf
turk
turn
tusk
tutu
tv
tva
twa
twig
twin
twit
two
twx
tx
type
typo
u
u's
u.s
ucla
ugh
ugly
uhf
uk
ulan
un
unit
unix
up
upon
urea
urge
uri
uris
urn
ursa
us
usa
usaf
usc
usda
use
usgs
usia
usn
usps
ussr
ut
utah
v
v's
va
vade
vail
vain
vale
vamp
van
vane
vary
vase
vast
vat
veal
veda
vee
veer
vega
veil
vein
vend
vent
vera
verb
very
vest
vet
veto
vex
vhf
vi
via
vial
vice
vida
vide
vie
viet
view
vii
viii
vile
vine
vis
visa
vise
vita
vito
viva
vivo
viz
void
volt
von
voss
vote
vow
vt
w
w's
wa
wac
wack
waco
wad
wade
wadi
wag
wage
wah
wahl
wail
wait
wake
wale
walk
wall
walt
wan
wand
wane
wang
want
war
ward
ware
warm
warn
warp
wart
wary
was
wash
wasp
wast
watt
wave
wavy
wax
waxy
way
we
we'd
weak
weal
wean
wear
web
webb
weco
wed
wee
weed
week
weep
wehr
wei
weir
weld
well
welt
went
wept
were
wert
west
wet
wham
what
whee
when
whet
whig
whim
whip
whir
whit
whiz
who
whoa
whom
whop
whup
why
wi
wick
wide
wier
wife
wig
wild
wile
will
wilt
wily
win
wind
wine
wing
wink
wino
winy
wipe
wire
wiry
wise
wish
wisp
wit
with
witt
wive
woe
wok
woke
wold
wolf
womb
won
wong
wont
woo
wood
wool
wop
word
wore
work
worm
worn
wove
wow
wrap
writ
wry
wu
wv
wy
wynn
x
x's
xi
y
y's
yah
yak
yale
yam
yang
yank
yap
yard
yarn
yaw
yawl
yawn
ye
yea
yeah
year
yell
yelp
yen
yet
yin
yip
ymca
yoga
yogi
yoke
yolk
yon
yond
yore
york
yost
you
your
yow
yuck
yuh
yuki
yule
yves
ywca
z
z's
zag
zan
zap
zeal
zen
zero
zest
zeta
zeus
zig
zinc
zing
zion
zip
zoe
zone
zoo
zoom
zorn

A permutation of a list or string is a rearrangement of the elements in the list or string. For example, given the list [1, 2, 3, 4], permutations would include 2, 4, 1, 3], 4, 3, 1, 2] and [3, 2, 4, 1 Likewise, given the string dome', permutations would include edo emod' and mode Write a function permutations that takes a string argument, opens the file words.txt (provided on Blackboard) and returns a list consisting of all permutations of the string argument found in the file (if any). The original word should not be included in the returned list. The function may return the words in any order inside the list. Examples: Function Call Return Value permutations veil') ['evil', 'levi', live', 'vile' permutations tori') riot', 'trio' permutations dad') add' permutations ado'

Explanation / Answer

For permutations you can use the following function-

static Set<String> permutations(String string){

        if (string.isEmpty()){

            return Collections.singleton(string);

        }

Else

{

            Set <String> s = new HashSet<>();

            for (int j=0; j<string.length(); j++)

                for (String st : permutations(string.substring(0, j) + string.substring(j+1)))

                    s.add(string.charAt(j) + st);

            return s;

        }

    }