Compressed suffix arrays and suffix trees with applications to text indexing and string matching