code: @Nonnull
      public Word<I> longestCommonPrefix(Word<?> other) {
          int len = length(), otherLen = other.length();
          int maxIdx = (len < otherLen) ? len : otherLen;
  
          int i = 0;
          while (i < maxIdx) {
              I sym1 = getSymbol(i);
              Object sym2 = other.getSymbol(i);
  
              if (!Objects.equals(sym1, sym2)) {
                  break;
              }
              i++;
          }
  
          return prefix(i);
      }
docs: Determines the longest common prefix of this word and another word.
  
  @param other
  the other word
  
  @return the longest common prefix of this word and the other word