简单题,数据量少,随便写都行
class Solution:
def maximumNumberOfStringPairs(self, words: List[str]) -> int:
ans = 0
for word in words:
if word[1] != word[0] and word[1] + word[0] in words:
ans += 1
return ans//2