Skip to content

Instantly share code, notes, and snippets.

@Todai88
Created April 21, 2017 10:39
Show Gist options
  • Save Todai88/b4135d06fc3531753288ba582f8d1275 to your computer and use it in GitHub Desktop.
Save Todai88/b4135d06fc3531753288ba582f8d1275 to your computer and use it in GitHub Desktop.
int main () {
// ### Setting up the variables
char input [100], blank[100];
fgets(input, 100, stdin);
int i = 0, k = 0;
// ### Looping over the array
while (input[i] != '\0') {
if (input[i] == ' ') {
int j = i + 1;
if (input[j] != '\0') {
while (input[j] != '\0' && input[j] == ' ') {
if (input[j] == ' ') {
i++;
}
j++;
}
}
}
blank[k] = input[i];
i++;
k++;
}
printf("%s", blank);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment