Lightweight algorithms for constructing and inverting the BWT of string collections