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