A particularly simple puzzles on round pegs

I just thought of this simple (at least I think it is simple) puzzle.

Consider a long loop of string and a number (at least 2) of round pegs of radius 1 inch each, parallel to each other. Drape the string around the pegs and pull the pegs so that the string is tight, as in the picture (which has only 3 pegs). Notice some sections of the string are straight and some are curved (shown in red in the picture).

Why is the total length of the curved sections equal to 2\pi?


This is related to a pulley puzzle of Harry Langman, published in 1949.