title: Problem in getline with multiple test cases
body: <p>I want to print the first letter of every word in a string. I have used the getline function to get the string with spaces. It works fine for the a single test case, but not working for multiple test cases. kindly help why this is happening and if possible pose a solution to get the answer for multiple test cases.</p>
  
  <pre><code>#include&lt;bits/stdc++.h&gt; 
  using namespace std; 
  
  string firstLetterWord(string str) { 
        string result = "";  
        if(str[0]!=' ')result.push_back(str[0]); 
      for (int i=1; i&lt;str.length(); i++) {  
          if (str[i] != ' ' &amp;&amp; str[i-1] == ' ') { 
              result.push_back(str[i]);    
          } 
      } 
      return result; 
  } 
  int main() { 
     string str;
     getline(cin,str);
     cout &lt;&lt; firstLetterWord(str); 
     return 0; 
  } 
  </code></pre>
  
  <p>if  I input 't' the number of test cases and then find the answers for the strings then the code is giving answer of only first test case.</p>