#include <stdio.h> #include <ctype.h> void parse_shell_input(char *line) { // Your logic here while (*line) { // 1) Skip leading separators (spaces or tabs) while (*line == ' ' || *line == '\t') { line++; } if (!*line) break; // end of string after skipping spaces // 2) Emit a token: all consecutive non-space/tab chars while (*line && *line != ' ' && *line != '\t') { putchar(*line); line++; } putchar('\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