code: public int transition(String path, int from)
      {
          int b = from;
          int p;
  
          for (int i = 0; i < path.length(); ++i)
          {
              p = b + (int) (path.charAt(i)) + 1;
              if (b == check[p])
                  b = base[p];
              else
                  return -1;
          }
  
          p = b;
          return p;
      }
docs: 沿着路径转移状态
  
  @param path 路径
  @param from 起点（根起点为base[0]=1）
  @return 转移后的状态（双数组下标）