title: How do i take in non-space separated inputs C++
body: <p>I want to count the number of '#' in a grid. This works if the imput is space separated but it doesn't if its not. How do I make the first one work?</p>
  
  <pre class="lang-none prettyprint-override"><code> 3 3    3 3
  .##    . # #
  #.#    # . #
  ###    # # #
  Fails  Works
  </code></pre>
  
  <pre class="lang-cpp prettyprint-override"><code>using namespace std;
  int main() {
      int h, w, i, o, total = 0;
      string current;
      cin &gt;&gt; h &gt;&gt; w;
      for (i = 0; i &lt; h; i++) {
          for (o = 0; o &lt; w; o++) {
              cin &gt;&gt; current;
              if (current == "#") {
                  total += 1;
              }
          }
      }
      cout &lt;&lt; total;
  }
  </code></pre>