Given two strings s1 and s2 consisting of only lowercase characters whose anagrams are almost equal. The task is to count the number of characters which needs to be edited(delete) to make s1 equal to s2.
Example:
Input:
s1 = madame
s2 = madam
Output:
1
Explanation:
String s1 = madame, string s2 = madam. 
character 'e' in first string needs to 
be deleted to make s1 equal to s2.
 
Your Task:
Print the count of characters needed to delete to make s1 and s2 equal. Complete the given function.
Expected Time Complexity: O(max(|s1|,|s2|))
Expected Auxilary Space: O(|s1| + |s2|) 
Constraints:
1 <= s1, s2 <= 10^{4}

Source: geeksforgeeks | Difficulty: EASY

Starter code: #User function Template for python3

class Solution:
	def countChars(self, s1, s2):
		#Code here

Solutions:
class Solution:

	def countChars(self, s1, s2):
		d = {}
		for i in s1:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
		e = {}
		for i in s2:
			if i in e:
				e[i] += 1
			else:
				e[i] = 1
		count = 0
		for i in d:
			if i not in e:
				count += d[i]
			else:
				count += abs(d[i] - e[i])
		count1 = 0
		for i in e:
			if i not in d:
				count += e[i]
			else:
				x = e[i] - d[i]
				if x > 0:
					count1 += x
		return max(count, count1)


class Solution:

	def countChars(self, s1, s2):
		(cc, sum) = (26 * [0], 0)
		for ch in s1:
			cc[ord('a') - ord(ch)] += 1
		for ch in s2:
			cc[ord('a') - ord(ch)] -= 1
		for i in cc:
			sum += abs(i)
		return sum