[scala] - make pairs by indices, count
Code\n\nobject Solution {\n  def maximumNumberOfStringPairs(words: Array[String]): Int = {\n    val counts =\n      words.indices.map { i =>\n        val revers
# Code\n```\nobject Solution {\n  def maximumNumberOfStringPairs(words: Array[String]): Int = {\n    val counts =\n      words.indices.map { i =>\n        val reversed = words(i).reverse\n        words.iterator.drop(i + 1).count(_ == reversed)\n      }\n    counts.sum\n  }\n}\n```
['Scala']