cybersecurity · advanced · ~15 min · safe pentest lab
Deduplicate the source IPs in a log.
Each log line starts with the client IP. Implement int distinct_ips(const char *log) returning the number of distinct leading IP strings (the token before the first space on each line).
#include <string.h>
int distinct_ips(const char *log) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.