#include <stdio.h> #include <ctype.h> void parse_shell_input(char *line) { // Your logic here char is_new = 0; while (*line != '\0') { if (*line != ' ') { if (is_new) { putchar('\n'); is_new = 0; } putchar(*line); } else { is_new = 1; } ++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