finds the no. of repetitions for strings in a list