#include <stdio.h> #include <ctype.h> void parse_shell_input(char *line) { int spacecount = 0; while(*line) { if(*line != ' ') { if(0 < spacecount) { printf("\n"); } printf("%c", *line); spacecount = 0; } else { spacecount++; } ++line; } } int main() { char line[101]; fgets(line, sizeof(line), stdin); parse_shell_input(line); return 0; }
Test Cases
Test Results
Input
led set 3 on
Expected Output