public function alphabet($pattern)
    {
        $s = array();
        foreach (preg_split("//u", $pattern, -1, PREG_SPLIT_NO_EMPTY) as $char) {
            $s[$char] = 0;
        }
        for ($i = 0; $i < mb_strlen($pattern); $i++) {
            $s[mb_substr($pattern, $i, 1)] |= 1 << (mb_strlen($pattern) - $i - 1);
        }
        return $s;
    }