#include <stdio.h> #include <ctype.h> void parse_shell_input(char *line) { // Your logic here char *left = line, *right = line; while(*left != '\0') { while(*left == ' ') left++; if(*left == '\0') break; right = left; while(*right != '\0' && *right != ' ') right++; char *p = left; while(p < right) { printf("%c",(*p)); p++; } printf("\n"); left = right; } } 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