int deletespace(char *str, char *res) {
int count = 0;
int i = 0;
while(*str != '\0'){
if (*str != ' ') {
res[i++] = *str;
}
else {
count++;
}
str++;
}
res[i + 1] = '\0';
return count;
}
int main() {
char str[] = "hello world";
cout << strlen(str) << endl;
char res[11] = "";
int count = deletespace(str, res);
cout << res << endl;
cout << count << endl;
system("pause");
return 0;
}