A line such as "=z" parsed into the pair ("", "z"). An empty value1
matches at every position and consumes nothing, so the scan in
replace_line never advanced and the program looped forever, printing
nothing and growing its output buffer until it was killed.
Reject the entry while parsing, reporting the offending line the same
way as a line with no "=" at all, and document the termination
invariant the loop depends on.
Drop the verbatim config.txt and input.txt listings from the example;
both files are in the repository root. Merge the whitespace and line
terminator notes into a single input-handling decision.
Reads value1=value2 pairs from a configuration file and replaces every
non-overlapping occurrence of value1 with value2 in a text file, printing
the resulting lines sorted by the number of symbols replaced.
Overlapping patterns resolve to the longest match so the result does not
depend on configuration file ordering. Ties keep their original file order.