#include <stdio.h>
#include <ctype.h>
void parse_shell_input(char *line) {
// Your logic here
char parse[10][10];
int i=0,j=0,k=0,c=0;
while (line[i] == ' ') i++;
while(line[i]!='\0'){
if(line[i]==' '){
parse[j][k] = '\0';
j++;k=0;c++;
while(line[i]==' '){
i++;
}
}
else{
parse[j][k] = line[i];
k++;i++;
}
}
if (k > 0) {
parse[j][k] = '\0';
c++;
}
for(i=0;i<c;i++){
printf("%s\n",parse[i]);
}
}
int main() {
char line[101];
fgets(line, sizeof(line), stdin);
parse_shell_input(line);
return 0;
}
Input
led set 3 on
Expected Output
led set 3 on