The below code doesnot work. Why the map function is returning type error? I have tried a many times. can someone give a proper reason for the below code?
n=26
string_array_1=[0]*n
string_array_2=[0]*n
string_1='ababc'
string_2='abab'
for char in string_1:
char_index=list(map[char])
string_array_1[char_index]=string_array_1[char_index]+1
for char in string_2:
char_index=string_2.index(char)
string_array_2[char_index]=string_array_2[char_index]+1
result=0
for i in range(26):
abs_diff=abs(string_array_1[i]-string_array_2[i])
result=result + abs_diff
print(result)