added almost working code for the first half of the burrows-wheeler transform