cybersecurity · intermediate · ~15 min · safe pentest lab
Count non-empty lines.
Size an enumeration wordlist by counting its non-empty lines.
Implement int count_subdomains(const char *list) that returns the number of non-empty newline-separated lines.
list: a NUL-terminated, \n-separated string of subdomain entries baked into the harness.Returns int: the count of lines that contain at least one character.
count_subdomains("a.x.com\nb.x.com\nc.x.com\n") -> 3
count_subdomains("a.x.com\n\nb.x.com\n") -> 2 (blank line skipped)
A NUL-terminated \n-separated subdomain list string.
An int: the number of non-empty lines.
Skip empty lines. Static string only.
int count_subdomains(const char *list) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.