code: public static String nextWord(String string) {
          int index = 0;
          while (index < string.length() && !Character.isWhitespace(string.charAt(index))) {
              index++;
          }
          return string.substring(0, index);
      }
docs: Return the next word of the string, in other words it stops when a space is encountered.