title: Sum and For loop together in Swift
body: <p>I want to know how many common characters in the given sets.</p>
  
  <pre><code>Input: J = "aA", S = "aAAbbbb"
  Output: 3
  </code></pre>
  
  <p>In the python solution for this as follows:</p>
  
  <pre><code>lookup = set(J)
  return sum(s in lookup for s in S)
  </code></pre>
  
  <p>I have following solution in Swift it works, but it looks too wordy. I want to learn shorter way of it.</p>
  
  <pre><code>class Solution {
      func checkInItems(_ J: String, _ S: String) -&gt; Int {
          let lookup = Set(J) ;
          var sy = 0;
          for c in S
          {
              if lookup.contains(c)
              {
                 sy += 1;                
              }
          }        
          return sy;
      }
  }
  </code></pre>