Split characters into lines

Based on <http://stackoverflow.com/a/7579022/96588>.