+ 3
🏆Challenge #5🏆
Code a program that would input a word that should contain atleast three words like input : "try" And your output will show all the possible combination using each letters of the word Output : "try, tyr, rty, ryt, yrt, ytr" Any language is accepted Good luck to all Sololearners 👍😃
5 Respuestas
+ 13
+ 4
+ 3
in javasthon:
split try
for i m
take m[i] splice m[i]
for j msplice
for k //variation
mvariation append msplice[(j+k)%msplicelengh]
combination[i]= m[i]+mvariation
combinations
in code: https://code.sololearn.com/c8I0A8zvaRnz/?ref=app
and here my old one https://code.sololearn.com/W1weyLtMw53T/?ref=app 😀
+ 1
In Ruby:
gets.chomp.split("").permutation.to_a.each { |w| print w.join + " " }