Deduplicate a list while preserving its first-seen order
Example input
apple
apple
pearExpected result
apple
pearEnable line trimming, empty-line removal and duplicate removal, and keep the original order. Trimming makes the first two lines identical, so only the first occurrence survives. Sorting is optional and should stay off when the input order has meaning. Copy the result into a new document so you retain the original list for comparison.