title: Shell script to find possible string sequences
body: <p>I have a text file in the following format:</p>
  
  <p><em>A Apple</em></p>
  
  <p><em>A Ant</em></p>
  
  <p><em>B Bat</em></p>
  
  <p><em>B Ball</em></p>
  
  <p><strong>The number of definitions of each character can be any number.</strong></p>
  
  <p>I am writing a shell script which will receive inputs like "A B". The output of the shell script I am expecting is the possible string sequences which can be created.</p>
  
  <p>For input "A B", the outputs will be:</p>
  
  <p><em>Apple Bat</em></p>
  
  <p><em>Apple Ball</em></p>
  
  <p><em>Ant Bat</em></p>
  
  <p><em>Ant Ball</em></p>
  
  <p>I tried <em>arrays</em>, It is not working as expected. Can anyone help with some ideas on how to solve this issue?</p>