Re: Трава перл...фсем курить;-)
Yury Kopyl
hrg на sama.ru
Чт Сен 25 06:50:44 CDT 2003
Hello, LaVei!
You wrote to <samara-pm на mail.pm.org> on Thu, 25 Sep 2003 16:30:07 +0500:
L> Как решить в одну строку это, я себе пока не представляю...
L> поэтому если участники не против то критерием будет Benchmark?;-)
L> Задача :
L> Написать программу на perl выводящую текст в виде прямоугольника с
L> заданной шириной.
L> До заданной ширины строку следует дополнять пробелами, начиная с
L> левой её части. Параметр, определяющий ширину результирующего
L> прямоугольника, гарантированно больше, чем самое длинное слово,
L> встречающееся в тексте.
L> Текст "A simple, easy to remember system for encoding integer
L> amounts can be very useful. For example, dealers at flea markets put
L> the information about an item on a card that they let potential
L> buyers see. They find it advantageous to encode the amount they
L> originally paid for the item on the card.\nA good system is to use a
L> substitution code, in which each digit is encoded by a letter. An
L> easy to remember 10-letter word or phrase, the key, is chosen. Every
L> '1' in the value is replaced by the first letter of the key, every
L> '2' is replaced by the second letter of the key, and so on. Every '0'
L> is replaced by the last letter of the key. Letters that do not
L> appear in the key can be inserted anywhere without affecting the
L> value represented by the code.. This helps to make the resulting
L> code much harder to break (without knowing the key).\nCreate a class
L> Substitute that contains the method getValue that is given the
L> Strings key and code as input and that returns the decoded value."
http://search.cpan.org/search?query=wrap&mode=all - это? :))
With best regards, Yury Kopyl. E-mail: hrg на sama.ru
Подробная информация о списке рассылки Samara-pm