#include <stdio.h> #include <ctype.h> void parse_shell_input(char *line) { char store[100]; int i = 0; int countspace = 0; while (line[i] != '\0'){ if (line[i]!= ' ') { printf ("%c", line[i]); countspace = 0; } else { countspace++; if (countspace<2){ printf ("\n"); } } i++; } } 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