title: Reverse Words in a String , I do not know why I am getting this output
body: <pre><code>class Solution {
  public:
      string reverseWords(string s) {
          int n=s.size();
          
          string p;
          vector&lt;string&gt; arr;
          
          
          for (int i=0;i&lt;n;i++){
              p=p+s[i];
              if (to_string(s[i]) == &quot; &quot;){
                  arr.push_back(p);
                  p = &quot;&quot;;
              }
              if (i==n-1){
                  arr.push_back(p);
                  break;
              }
          }
          string q;
          int m=arr.size();
          for (int j=m-1;j&gt;=0;j--){
              q=q+arr[j];
          }
          
          return q;
          
      }
  };
  </code></pre>
  <pre><code>Wrong Answer
  Runtime: 0 ms
  Your input
  &quot;the sky is blue&quot;
  Output
  &quot;the sky is blue&quot;
  Expected
  &quot;blue is sky the&quot;
  </code></pre>