Syntax error of getindex in my code

Fuad_Sami
Sun, 22 Sep 2019 10:32:59 +0000
New to Julia

this is the error : LoadError(“main.jl”, 5, ErrorException(“syntax: invalid iteration specification”))

function makeAnagram(a::String,b::String)

lettercounts = zeros(Int,27)
      for i in a
      a1 = a[i]
          lettercounts[Int(a1) - Int('a')] += 1
      end
      for i in b
      b1 = b[i]
          lettercounts[Int(b1) - Int('a')] -= 1
      end
      result = 0
      for i in lettercounts
     result += abs(i)
end
      return result


end
a="abcd"
b = "abcd"
println("Total  " , makeAnagram( a,b))

12 posts - 7 participants