title: Accept 2 Strings and display common chars in them
body: <p>I am using the code below to find common characters in two strings. Sometimes this code produces wrong results such as giving output value which is greater than string lengths.</p>
  
  <pre><code>for(int i = 0;i &lt; num1.length();i++){
                  for(int j =0;j &lt; num2.length();j++){
                      if(num1.charAt(i) == num2.charAt(j)){
                          count++;
                      }
                  }
              }
  </code></pre>