title: Input C-style string and get the length
body: <p>The string input format is like this</p>
  
  <p>str1 str2</p>
  
  <p>I DONT know the no. of characters to be inputted beforehand so need to store 2 strings and get their length.
  Using the C-style strings ,tried to made use of the scanf library function but was actually unsuccessful in getting the length.This is what I have:</p>
  
  <pre><code>// M W are arrays of char with size 25000
     while (T--)
     {
         memset(M,'0',25000);memset(W,'0',25000);
         scanf("%s",M);
         scanf("%s",W);
         i = 0;m = 0;w = 0;
         while (M[i] != '0')
                {
                    ++m; ++i;  // incrementing till array reaches '0'
                }
          i = 0;
         while (W[i] != '0')
                {
                    ++w; ++i;
                }
         cout &lt;&lt; m &lt;&lt; w;
  
  
     }
  </code></pre>
  
  <p>Not efficient mainly because of the <code>memset</code> calls.</p>
  
  <p>Note:
  I'd be better off using <code>std::string</code> but then because of 25000 length input and memory constraints of cin I switched to this.If there is an efficient way to get a string then it'd be good</p>