How to generate k+1 length strings from a list of k lengthstrings?

Sibylle Koczian Sibylle.Koczian at Bibliothek.Uni-Augsburg.de
Fri Jun 9 06:18:01 EDT 2006


Girish Sahani schrieb:
> Yes it is the former of course.Common elements could be in any order in
> both strings.
> Thanks Marc :)...though we need to add an if for checking the length of
> the string (k+1).
> 

No, why? Every character from string1 is removed from string2 at most
once. And string2 is added to string1 if and only if it has length 1; if
not, string1 is set to the empty string. So either string1 is empty or
it has length k+1. Or did you mean checking if string1 is empty?

-- 
Dr. Sibylle Koczian
Universitaetsbibliothek, Abt. Naturwiss.
D-86135 Augsburg
e-mail : Sibylle.Koczian at Bibliothek.Uni-Augsburg.DE



More information about the Python-list mailing list