title: How to Find the word that comes after a specified word in java String
body: <p>My program has a String inputted Eg. hello i am john who are you oh so i see you are also john i am happy</p>
  <p>my program then has a keyword inputted Eg. i (the program doesn't like capitals or punctuation yet)</p>
  <p>then it reads the initial String and finds all the times it mentions the keyword + the word after the keyword, Eg. i am, i see, i am.</p>
  <p>with this is finds the most common occurrence and outputs that second word as the new keyword and repeats. this will produce
  i am john/happy (when it comes to an equal occurrence of a second word it stops (it is meant to))</p>
  <p>What i want to know is how i find the word after the keyword.</p>
  <pre><code>package main;
  
  import java.util.Scanner;
  
  public class DeepWriterMain {
  
      public static void main(String[] args) {
      
          String next;
          Scanner scanner = new Scanner(System.in);
          System.out.println(&quot;text:&quot;);
          String input = scanner.nextLine();
          System.out.println(&quot;starting word:&quot;);
          String start = scanner.nextLine();
          input.toLowerCase();
          start.toLowerCase();
          if (input.contains(start)) {
               System.out.println(&quot;Loading... (this is where i find the most used word after the 'start' variable)&quot;);
               next = input.substring(5, 8);
               System.out.println(next);
           }else {
               System.out.println(&quot;System has run into a problem&quot;);
           
           }
      }
  </code></pre>
  <hr />
  <p>}</p>