If the pipe is longer than this the dryer will operate poorly. Having said all this this the most common problem we see is with roof terminations of the dryer vent pipe where the home has been re-roofed.
The correct vent is the first photo, however the screen must be removed or it becomes blocked with lint and poses a fire hazard.
The second photo is an off ridge attic vent which is not designed or intended for dryer venting.
These are regularly installed by lazy roofers posing numerous issues for the home owner.
Number 1: It will become blocked and #2 it will cause the dryer to vent moisture into the attic possibly damaging the roof decking and creating a lint fire hazard in the attic.