✅👌JAVA | 2 DIFFERENT APPROACH | EASY
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int maximumNumberOfStringPairs(String[] words) {\n        HashSet<String>set=new HashSet<>();\n        for(String s:words){\n            set.add(s);\n        }\n        System.out.println(set);\n\n        int count=0;\n        for(int i=0;i<words.length;i++){\n            String rev=reverse(words[i]);\n            set.remove(words[i]);\n            if(set.contains(rev)){\n                count++;\n                set.remove(rev);\n                \n            }\n        }\n        return count;\n    }\n\n    public String reverse(String temp){\n        char ch[]=temp.toCharArray();\n        char cur=ch[0];\n        ch[0]=ch[1];\n        ch[1]=cur;\n        String ans="";\n        for(int i=0;i<ch.length;i++){\n            ans+=ch[i];\n        }\n\n        return ans;\n    }\n}\n```
['Java']