#include <stdio.h> #include <ctype.h> void parse_shell_input(char *input) { // Your logic here int i = 0; while (input[i] != '\0') { // Skip spaces while (input[i] == ' ') i++; // If end of string, stop if (input[i] == '\0' || input[i] == '\n') break; // Print characters of word while (input[i] != ' ' && input[i] != '\0' && input[i] != '\n') { printf("%c", input[i]); i++; } printf("\n"); } } 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