Implement Burrows Wheeler encoding