#include #include #include "auxiliar.h" int check_length(char **inputs, uint8_t num_inputs) { int input_length = strlen(inputs[0]); if(input_length != strlen(inputs[1])) { return -1; } return input_length; } int main(int argc, char **argv) { int i; int pos; if(argc != 2) { error(); } char *input = argv[1]; if(!strcmp(input,"error")) { error(); } char **inputs = comma_separate(input); if(inputs == NULL) { error(); } int num_inputs = num_occurrences(input,','); if(num_inputs != 2) { error(); } int input_length = check_length(inputs,num_inputs); int a,b; a = bin2dec(inputs[0]); b = bin2dec(inputs[1]); if(a > b) { printf("1,0,0"); } else if(a < b) { printf("0,0,1"); } else if(a == b) { printf("0,1,0"); } free_mem(inputs,num_inputs); return 0; }