title: Assign integers from dictionary values to characters of a string
body: <p><code>indices</code> and <code>for value in</code> nicely gives me the loop I'm looking for however I need to go a step further and assign the values of the dictionary to the matching characters of the string then perform calculation for score. </p>
  
  <p>I'd like to know the most Swifty way to accomplish this. Is this possible using <code>map</code>? <code>let curChar = n.map({ print($0) })</code>.</p>
  
  <p>The other issue is that Javascript lets you used heterogeneous dictionaries of type easily but with Swift we need to match types. </p>
  
  <pre><code>var dict: [String:Any] = ["a":1, "j":1, "s":1, "b":2, "k":2,"r":9/*...*/]
  
  let n = "lighthouse"
  var nScore = 0
  
  for i in n.indices[n.startIndex..&lt;n.endIndex] {
  let curChar = n[i]
  var curVal = dict[curChar] 
  nScore = nScore + curVal
  </code></pre>
  
  <p>The original Javascript block.</p>
  
  <pre><code>var dict = {A:1, J:1, S:1, B:2, K:2, T:2...};
  var n = "lighthouse";
  var nScore = 0;
  
  for( var i = 0; i &lt; n.length; i++ );
  {
      var curChar = n.charAt( i );
      var curVal = dict[ curChar ];
      nScore = nScore + curVal;
  }
  </code></pre>