a method that finds the length of each string element in an array