Well, ok i decided to give you hint but not the answer, here you go with some sample pesudo code. This should give you an idea on how to approch this problem.
character  source = " We dont do your homework "
charater  destination;
Fetch each char from the source array
Check if the fetched char is white space char
if so continue the loop
if not space char
copy that char into destination
print the destination ( with no white space in it )