Find a given four-digit word from a set of characters of the English alphabet

Viewed 44

help me understand the task and if it is not difficult, could you tell me how I could do it, I do not ask you to completely decide for me, just show me the way. Task: Find a given four-digit word from the set of characters of the English alphabet. Each character is defined by a separate generated stream. I would be very grateful.

1 Answers

Based on what you're telling us, I think perhaps the goal is to find "permutations" (of your input characters) that match "actual words".

Specifically:

https://www.geeksforgeeks.org/write-a-c-program-to-print-all-permutations-of-a-given-string/

A permutation, also called an “arrangement number” or “order,” is a rearrangement of the elements of an ordered list S into a one-to-one correspondence with S itself. A string of length n has n! permutation.

Source: Mathword

Below are the permutations of string ABC:

ABC ACB BAC BCA CBA CAB

Your program might do the following:

  1. Build a list of "English words"
  2. Read "characters" from the stream
  3. Generate permutations
  4. For each permutation:
    • Search through the list of English words
    • Check if the current permutation corresponds to the next word in your list
    • If it does, print the permutation and the word
Related