title: Unable to output the characters inside the same occurrence
body: <p>The user will input a character that appears twice in a phrase, and I need to output the part of the phrase that is between the two occurrences of the character.  For example, if the character is <code>*</code> and the phrase is <code>the cow *jumped* over the moon</code>, the output would be <code>jumped</code>.</p>
  
  <p>I got part of my code working which checks the occurrence of the character in the phrase, but I am facing the difficulty of outputting the word inside that character. Also, this has to be done only using a <code>for</code> loop.  </p>
  
  <pre><code>char x = keyboard.next().charAt(0);
  for (int y = 0; y &lt; phrase.length(); y++) {
      char n = phrase.charAt(y);
      if (n == x)
          System.out.print(n);
  }
  </code></pre>