Two pointers || JAVA
\n# Code\n\nclass Solution {\n    public boolean areAlmostEqual(String s1, String s2) {\n        if(s1.equals(s2)) return true;\n        int p1 = -1, p2 =-1;\n 
\n# Code\n```\nclass Solution {\n    public boolean areAlmostEqual(String s1, String s2) {\n        if(s1.equals(s2)) return true;\n        int p1 = -1, p2 =-1;\n        if(s1.length() != s2.length()) return false;\n\n        for(int i=0; i< s1.length(); i++){\n            char c1 =s1.charAt(i);\n            char c2 =s2.charAt(i);\n\n            if(c1 != c2 && p1 == -1){\n                p1 =i;\n            }\n            else if(c1 != c2 && p2 == -1){\n                p2 =i;\n            }\n            else if(c1 != c2 && ((p1 != -1) && (p2 != -1))){\n                return false;\n            }\n        }\n        if(p1 == -1 || p2 == -1) return false;\n        return (s1.charAt(p1) == s2.charAt(p2)) && (s1.charAt(p2) == s2.charAt(p1));\n    }\n}\n```
['Java']