title: Check for same vowel twice in a row
body: <p>I'm trying to write a program (really a section of a program) that checks to see if any vowels recur twice in a row.
  For ex. <code>input = boo, output = o</code></p>
  <p>This is the code I have so far for this:</p>
  <pre class="lang-java prettyprint-override"><code>//j - displays any vowels which occur consecutively
  System.out.print(&quot;\nj. &quot;);
  
  // have to give these variables a value
  // otherwise the default statements won't work
  char current_letter_1 = ' ', current_letter_2 = ' ';
  
  //making strings for these characters so they are easier to output
  String current_letter_1_string = String.valueOf(current_letter_1);
  String current_letter_2_string = String.valueOf(current_letter_2);
  
  //checking it against the sentence in lowercase so it's case insensitive
  char low_letter = e.charAt(ind);
  
  while (ind &lt; a) {
      current_letter_1_string = String.valueOf(current_letter_1);
      current_letter_2_string = String.valueOf(current_letter_2);
  
      low_letter = e.charAt(ind);
  
      switch (low_letter) {
          case 'a', 'e', 'i', 'o', 'u', 'y':
              current_letter_1 = low_letter;
              break;
          default:
              break;
      }
      ind += 1;
      switch (low_letter) {
          case 'a', 'e', 'i', 'o', 'u', 'y':
              current_letter_2 = low_letter;
              break;
          default:
              break;
      }
      if (current_letter_1 == current_letter_2) {
          System.out.print(current_letter_2_string.trim() + &quot; &quot;);
      } else {
      }
      //in case the same vowel is repeated more than twice in a row
  }
  while (low_letter == current_letter_2 &amp;&amp; ind &lt; a) {
      low_letter = e.charAt(ind);
      ind += 1;
  }
  if (low_letter != current_letter_2) {
      ind += 1;
  } else {
  }
  </code></pre>
  <p>Btw since this is a subsections of a larger program I'll give you some variable values:</p>
  <pre class="lang-java prettyprint-override"><code>Scanner sc(System.in);
  String sentence = sc.nextLine();
  int a = sentence.length();
  String e = sentence.toLowerCase();
  int ind = 0;
  </code></pre>
  <p>Also, this is for school so if it looks really weird and you would do this completely differently, bear with me. This code <em>sort of</em> works, but the output is always weird, even with <code>trim()</code>, the variable is still outputted with space in front of it. Also, if <code>sentence</code> contains more than one repeated vowel, the output is screwed up again.
  Any help is much appreciated.</p>