-1

I have to Prompt the user to enter his/her name and Print all combinations of three letters from the name. How to write script for this?

  • 2
    Welcome to Unix&Linux, We’d love to help you, but the reality is that not every question gets answered, do some research by yourself and then if problem exists then ask question. You may find this link useful: unix.stackexchange.com/questions/how-to-ask – Tejas May 26 '14 at 6:46
  • 1
    is this a homework problem? – mdpc May 26 '14 at 6:55
1

Once you have read the user name, you need to split te name in letters. Decide how to store the different letters (tmpfile, array, ..) Then loop through the letters: Dirty: a lot of nested loops for (letter1) / for (letter2) / .. / for (maxlength) Difficult 1: use while loop Difficult 2: use ecursive function

Alternative: Generate all 3-letter combi and make a check function for filtering these combi to your result.

Advanced: use different approaches and compare.

Not the answer you're looking for? Browse other questions tagged or ask your own question.