title: Why is my code not working as expected?
body: <p>I'm writing a code to input few strings and compare the lengths  of the strings and then print the shorter string to console output. but the code isn't working as expected, and upon giving any set of inputs, the output I get is a blank screen (no string gets displayed). Can anyone tell me what I'm doing wrong?</p>
  
  <p>The <code>input</code> array has strings supplied by the user and these strings are also present in <code>a</code>, so that the line (<code>string[i] == a[j]</code>) will execute to true for a specific value in <code>a</code>. </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string.h&gt;
  using namespace std;
  
  int main()
  {
      long n, m;
      cin &gt;&gt; n &gt;&gt; m;
      char a[m][10], b[m][10]; // will print the shorter out of these two
      for (long i = 0; i &lt; m; i++) cin &gt;&gt; a[i] &gt;&gt; b[i];
      char input[n][10];
      for (long i = 0; i &lt; n; i++) cin &gt;&gt; input[i];
      for (long i = 0; i &lt; n; i++)
      {
          for (long j = 0; j &lt; m; j++)
          {
              if (input[i] == a[j]) // checks which set of a,b does this input correspond to
              {
                  if (strlen(a[j]) &gt; strlen(b[j])) cout &lt;&lt; b[j];
                  else cout &lt;&lt; a[j];
                  if (i &lt; n - 1) cout &lt;&lt; " ";
              }
          }
      }
  }
  </code></pre>
  
  <p>I think that something is wrong with the code (<code>input[i] == a[j]</code>) but I'm not sure what.</p>