Company: Ion Group - Hackerrank_17thjuly
Difficulty: easy
You're given two arrays of strings, s and t , each holding n entries. Each pair (s[i], t[i]) consists of two lowercase English strings. Call two strings similar if, for every letter x from 'a' to 'z' , the counts of x in the two strings never differ by more than 3 . Your task: for each pair (s[i], t[i]) , decide whether the two strings are similar, and report YES if they are and NO otherwise. Example Suppose s = ["aabaab", "aaaaabb"] and t = ["bbabbc", "abbbbbb"] . The answer is ["YES", "NO"] . Analysis of the first pair: letter s[0] count t[0] count difference a 4 1 3 b 2 4 2 c 0 1 1 No letter differs by more than 3, so this pair is similar. Analysis of the second pair: letter s[1] count t[1] count difference a 5 1 4 b 2 6 4 Here 'a' and 'b' both violate the condition, so this pair is not similar. Input Format The first line contains an integer n . The next n lines each contain one string element of s . The next line contains the integer n again. The next n lines each contain one stri