Combinations of characters

Can someone give me a code that works as follows:

Input :
A word containing at max 10 "team"

The program should print the different words that can be formed using these letters.
eg:team,tema,taem,tame,tmae,tmea, and so on. So the 4 letters give 4! that is 24 words.

I am stuck up badly as I cant get any idea.Please someone help.😕


  • Prasad Ajinkya
    Prasad Ajinkya
    Here's a hint - Use recursion or while loop.

    You need to -
    1. first divide the string into an array of characters ... so "team" becomes 't','e','a','m'
    2. Then just make a recursive function to output the letter

    Get it?
  • Ashutosh_shukla
    Thanks your advice worked.I got some weird looking code but it worked in some cases.Can you please check it out.
    char str[10];
    static int index[10];
    int len;
    int count=0;
    void anagram()
      int p,q,flag;
     cout<<"\nThe anagrams found are as follows : \n";
     cout<<"Press enter to get next anagram : \n";

You are reading an archived discussion.

Related Posts

wat kind of the authentictaion does the My Sql server provides to the users
Hi Everybody, This is Ruhi Jain from HCLTECH(Gurgaon). I always wanted to join a forum/site that make me proud of my Engineering. Something that's crazy n exclusively for Engineers. It...
heyyyy i m final year mechanical engg. student cn nyone help in suggestin me a good project it wud be better if it is a workin one
CEans, CE announces its CE Ambassadors Team comprising of following selected CEans :- CEan - durga CEan - Differential CEan - sauravgoswami Many congratulations to selected CEans. Discuss this announcement...
This is hemanth. Studying 2nd b-tech in ECE streem. I am thinking to give a presentation regarding to electronics. Will some one help me out in choosing a apropriate topic...