concierge/challenge/challenge.c

27 lines
504 B
C

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
int ret;
size_t nbytes = 0;
char *input_str = NULL;
char *password = "23door42\n";
puts("Please enter Password: ");
ret = getline(&input_str, &nbytes, stdin);
if (ret == -1) {
puts("Error");
} else if (strcmp(input_str, password) == 0) {
puts("Success");
ret = 0;
} else {
puts("How about no?!");
ret = -1;
}
free(input_str);
return ret;
}