basic bwt and fm-index implementation