[ create a new paste ] login | about

Link: http://codepad.org/PkoOlWgb    [ raw code | output | fork ]

C++, pasted on Nov 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>
#include <ctype.h>

int main(int argc, char* argv[])
{
	char str[256] = "c++       is      programming   language\0";

	printf("%s\n",str);

	for (int i = 0; str[i] != '\0'; i++)
		if (isspace(str[i]) && isspace(str[i+1]))
			while(isspace(str[i+1]))
			{
				for (int j = i; str[j] != '\0'; j++)
					str[j] = str[j+1];
			}

	printf("%s\n",str);
}


Output:
1
2
c++       is      programming   language
c++ is programming language


Create a new paste based on this one


Comments: