title: Add all digits of a string in c++
body: <p>I am trying to add all the digits of a string in c++, but it cannot passes all test cases. My code is given below.</p>
  
  <pre><code> #include &lt;iostream&gt;
  using namespace std;
  
  int main()
  {
      string str;
      long long int count=0;
      cin&gt;&gt;str;
      for(int i=0;i&lt;str.length();i++)
      {
          count+=(str[i]-'0');
      }
      cout&lt;&lt;count&lt;&lt;endl;
      return 0;
  }
  </code></pre>
  
  <p>Don't know how to resolve this problem can anyone help me out???</p>