title: Eliminating all extra spaces in a string
body: <p>Function has to eliminate all extra spaces between the words and punctuation marks but punctuation marks must not have any space between them and the word before them.</p>
  <p>for example i have this string:</p>
  <pre><code>Hey   ,how   are you today    ?
  </code></pre>
  <p>and i should get  this:</p>
  <pre><code>Hey, how are you today?
  </code></pre>
  <p>this function eliminates extra spaces in here. But I don't know how to include the punctuation marks</p>
  <p>btw I am caling this function in the main function</p>
  <pre><code>void space_rule(char *str[]){
  printf(&quot;Enter a string: &quot;);
  gets(*str);
  puts(*str);
  
  char *p = strtok(*str, &quot; &quot;);
      while(*p!=NULL){
      printf(&quot;%s &quot;,p);
      p=strtok(NULL, &quot; &quot;);
  }
  
  }
  </code></pre>