#include <stdio.h>
#include <ctype.h>
void parse_shell_input(char *line) {
    char token[101];
    int i = 0, j = 0;
    while (line[i] != '\0') {
        if (line[i] != ' ' && line[i] != '\n') {
            token[j++] = line[i];
        } else {
            if (j > 0) {
                token[j] = '\0';
                printf("%s\n", token);
                j = 0;
            }
            // Skip multiple spaces
        }
        i++;
    }
    // Print last token if any
    if (j > 0) {
        token[j] = '\0';
        printf("%s\n", token);
    }
}
int main() {
    char line[101];
    fgets(line, sizeof(line), stdin);
    parse_shell_input(line);
    return 0;
}Step-by-Step Solving Algorithm
fgets() to read up to 100 characters into a buffer'\n') if presenti: scans the input character by characterj: builds each token into a temporary buffertoken[j++]j > 0, terminate the token with '\0', print it, and reset j = 0j > 0, print the final token
Input
led set 3 on
Expected Output
led set 3 on