# Task
Two arrays are called similar if one can be obtained from another by swapping at most one pair of elements.

Given two arrays, check whether they are similar.

# Example

For `A = [1, 2, 3]` and `B = [1, 2, 3]`, the output should be `true;`

For `A = [1, 2, 3]` and `B = [2, 1, 3]`, the output should be `true;`

For `A = [1, 2, 2]` and `B = [2, 1, 1]`, the output should be `false.`

# Input/Output

- `[input]` integer array `A`

Array of integers.

Constraints: `3 ≤ A.length ≤ 10000, 1 ≤ A[i] ≤ 1000.`

- `[input]` integer array `B`

Array of integers of the same length as `A`.

Constraints: `B.length = A.length, 1 ≤ B[i] ≤ 1000.`

- `[output]` a boolean value

`true` if `A` and `B` are similar, `false` otherwise.

Difficulty: EASY
Starter code: def are_similar(a, b):
	

Solutions:
def are_similar(a, b):
	return sorted(a) == sorted(b) and sum((i != j for (i, j) in zip(a, b))) in [0, 2]


from collections import Counter

def are_similar(a, b):
	return sum((a_ == b_ for (a_, b_) in zip(a, b))) >= len(a) - 2 and Counter(a) == Counter(b)


def are_similar(a, b):
	c = [a[i] - b[i] for i in range(len(a)) if a[i] != b[i]]
	return c == [] or (len(c) == 2 and c[0] + c[1] == 0)


def are_similar(a, b):
	return sorted(a) == sorted(b) and sum((m != n for (m, n) in zip(a, b))) <= 2


def are_similar(a, b):
	return sorted(a) == sorted(b) and sum((1 for (x, y) in zip(a, b) if x != y)) <= 2


are_similar = lambda a, b: 3 * (sorted(a) != sorted(b)) + sum((e != b[i] for (i, e) in enumerate(a))) < 3


def are_similar(a, b):
	swap = 0
	for (idx, x) in enumerate(a):
		if a.count(x) != b.count(x):
			return False
		if x != b[idx]:
			swap += 1
			if swap > 2:
				return False
	return True


def are_similar(a, b):
	unmatch = list(filter(lambda x: x[0] != x[1], zip(a, b)))
	if len(unmatch) != 2:
		return unmatch == []
	return unmatch[0][::-1] == unmatch[1]


from collections import Counter

def are_similar(a, b):
	return len(a) - sum((v1 == v2 for (v1, v2) in zip(a, b))) in {0, 2} and Counter(a) == Counter(b)


from collections import Counter

def are_similar(a, b):
	return sum((i != j for (i, j) in zip(a, b))) <= 2 and Counter(a) == Counter(b)