Everyone gets 5 notecards with their name on them. Each person places their notecards at places in the line that they think splits the line into 4 (approximately) equally valuable segments. (One notecard will be at the very beginning of the line; one will be at the very end; the other three are in the middle where the person thinks is fair.) The neat trick is that you can now pick one segment for each person, such that the segments don't overlap. Give each person the candy from that segment, and everyone receives their fair share. And there's (probably) some candy leftover.
Here's how you do that: start scanning the line of candy from left to right. When you get to the second notecard of a given person, give that person all the candy between their first and second notecards. That person is now out: they have their fair share. Remove their remaining notecards. Now continue scanning from their second notecard. You can prove that by the end, everyone will have received one of their segments.
(If two people's notecards are in the same place, pick one at random.)
In contrast to this cake division algorithm, it leaves awkward leftovers. It's also gamable - if you know other people's preferences you might want to lie about your own.