#include <stdio.h> #include <ctype.h> void parse_shell_input(char *line) { // Your logic here int is_cmd = 0; int i = 0; while(line[i] != '\0' && line[i] != '\n') { if(line[i] == ' ') { if(is_cmd == 1) { is_cmd = 0; printf("\n"); } } else { is_cmd = 1; printf("%c", line[i]); } 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