cybersecurity · intermediate · ~15 min · safe pentest lab
Measure the longest consonant run — algorithmically-generated domains pile up consonants.
Malware DGAs produce unpronounceable domains. Implement one signal:
int longest_consonant_run(const char *label);
Return the longest run of consecutive consonant letters (any letter that is not a/e/i/o/u, case-insensitive). Digits, '-', '.', and vowels break the run.
A domain label string.
Longest consonant-run length.
Case-insensitive; non-letters break runs.
#include <stddef.h>
/* Longest run of consecutive consonant letters (a letter that is not a,e,i,o,u; case-insensitive).
Any non-letter (digit, '-', '.') breaks the run. */
int longest_consonant_run(const char *label){ (void)label; return 0; }
Treating digits as consonants; not lowercasing before the vowel test.
aeiou -> 0; xkcd -> 4; empty -> 0.
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.