I'd tried to write source code in an answer. But the format divers between editing mode and released answer. Could you give me an advice, how many characters a line consists of or how can I format my code?
released answer code
formated code in editor of the answer site