Engineering rank queries on bit vectors and strings