---
# System prepended metadata

title: 2068. Check Whether Two Strings are Almost Equivalent
tags: [Leetcode, Easy]

---

# 2068. Check Whether Two Strings are Almost Equivalent
###### tags: `Leetcode` `Easy`
Link: https://leetcode.com/problems/check-whether-two-strings-are-almost-equivalent/description/
## Code
```java=
class Solution {
    public boolean checkAlmostEquivalent(String word1, String word2) {
        int[] cnt1 = new int[26];
        int[] cnt2 = new int[26];
        for(int i=0; i<word1.length(); i++){
            cnt1[word1.charAt(i)-'a']++;
        }
        for(int i=0; i<word2.length(); i++){
            cnt2[word2.charAt(i)-'a']++;
        }
        for(int i=0; i<26; i++){
            if(Math.abs(cnt1[i]-cnt2[i])>=4) return false;
        }
        return true;
    }
}
```