#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include <stdlib.h>
using namespace std;
char * removeMultipleSpaces(char * str)
{
int i,j = 0;
bool in = false;
for(i = 0; str[i] != '\0'; i++)
{
if(str[i] != ' ')
{
str[j++] = str[i];
in = false;
}
else
{
if(in)
{
i++;
}
else
{
str[j++] = str[i];
in = true;
}
}
}
str[j] = '\0';
return str;
}
int main()
{
char str[] = "lsjd lsdk ksdj d";
removeMultipleSpaces(str);
printf("%s\n",str);
system("pause");
return 0;
}