Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def blah(strings, string):
- strings = [s for s in strings if s in string]
- for s in strings:
- string = ''.join(string.split(s))
- if not string:
- return True
- return False
- lista = [
- "a",
- "ab",
- "abc",
- "abcd",
- "abcde",
- "abcdef",
- "abcdefg",
- "abcdefgh",
- "abcdefghj",
- "abcdefghji",
- "abcdefghjij",
- "abcdefghjijk",
- "abcdefghjijkl",
- "abcdefghjijklm",
- "abcdefghjijklmn",
- "abcdefghjijklmno",
- "abcdefghjijklmnop",
- "abcdefghjijklmnopq",
- "abcdefghjijklmnopqr",
- "abcdefghjijklmnopqrs",
- "abcdefghjijklmnopqrst",
- "abcdefghjijklmnopqrstu",
- "b",
- "bc",
- "bcd",
- "bcde",
- "bcdef",
- "bcdefg",
- "bcdefgh",
- "bcdefghj",
- "bcdefghji",
- "bcdefghjij",
- "bcdefghjijk",
- "bcdefghjijkl",
- "bcdefghjijklm",
- "bcdefghjijklmn",
- "bcdefghjijklmno",
- "bcdefghjijklmnop",
- "bcdefghjijklmnopq",
- "bcdefghjijklmnopqr",
- "bcdefghjijklmnopqrs",
- "bcdefghjijklmnopqrst",
- "bcdefghjijklmnopqrstu",
- "c",
- "cd",
- "cde",
- "cdef",
- "cdefg",
- "cdefgh",
- "cdefghj",
- "cdefghji",
- "cdefghjij",
- "cdefghjijk",
- "cdefghjijkl",
- "cdefghjijklm",
- "cdefghjijklmn",
- "cdefghjijklmno",
- "cdefghjijklmnop",
- "cdefghjijklmnopq",
- "cdefghjijklmnopqr",
- "cdefghjijklmnopqrs",
- "cdefghjijklmnopqrst",
- "cdefghjijklmnopqrstu",
- "d",
- "de",
- "def",
- "defg",
- "defgh",
- "defghj",
- "defghji",
- "defghjij",
- "defghjijk",
- "defghjijkl",
- "defghjijklm",
- "defghjijklmn",
- "defghjijklmno",
- "defghjijklmnop",
- "defghjijklmnopq",
- "defghjijklmnopqr",
- "defghjijklmnopqrs",
- "defghjijklmnopqrst",
- "defghjijklmnopqrstu",
- "e",
- "ef",
- "efg",
- "efgh",
- "efghj",
- "efghji",
- "efghjij",
- "efghjijk",
- "efghjijkl",
- "efghjijklm",
- "efghjijklmn",
- "efghjijklmno",
- "efghjijklmnop",
- "efghjijklmnopq",
- "efghjijklmnopqr",
- "efghjijklmnopqrs",
- "efghjijklmnopqrst",
- "efghjijklmnopqrstu",
- "f",
- "fg",
- "fgh",
- "fghj",
- "fghji",
- "fghjij",
- "fghjijk",
- "fghjijkl",
- "fghjijklm",
- "fghjijklmn",
- "fghjijklmno",
- "fghjijklmnop",
- "fghjijklmnopq",
- "fghjijklmnopqr",
- "fghjijklmnopqrs",
- "fghjijklmnopqrst",
- "fghjijklmnopqrstu",
- "g",
- "gh",
- "ghj",
- "ghji",
- "ghjij",
- "ghjijk",
- "ghjijkl",
- "ghjijklm",
- "ghjijklmn",
- "ghjijklmno",
- "ghjijklmnop",
- "ghjijklmnopq",
- "ghjijklmnopqr",
- "ghjijklmnopqrs",
- "ghjijklmnopqrst",
- "ghjijklmnopqrstu",
- "h",
- "hj",
- "hji",
- "hjij",
- "hjijk",
- "hjijkl",
- "hjijklm",
- "hjijklmn",
- "hjijklmno",
- "hjijklmnop",
- "hjijklmnopq",
- "hjijklmnopqr",
- "hjijklmnopqrs",
- "hjijklmnopqrst",
- "hjijklmnopqrstu",
- "j",
- "ji",
- "jij",
- "jijk",
- "jijkl",
- "jijklm",
- "jijklmn",
- "jijklmno",
- "jijklmnop",
- "jijklmnopq",
- "jijklmnopqr",
- "jijklmnopqrs",
- "jijklmnopqrst",
- "jijklmnopqrstu",
- "i",
- "ij",
- "ijk",
- "ijkl",
- "ijklm",
- "ijklmn",
- "ijklmno",
- "ijklmnop",
- "ijklmnopq",
- "ijklmnopqr",
- "ijklmnopqrs",
- "ijklmnopqrst",
- "ijklmnopqrstu",
- "j",
- "jk",
- "jkl",
- "jklm",
- "jklmn",
- "jklmno",
- "jklmnop",
- "jklmnopq",
- "jklmnopqr",
- "jklmnopqrs",
- "jklmnopqrst",
- "jklmnopqrstu",
- "k",
- "kl",
- "klm",
- "klmn",
- "klmno",
- "klmnop",
- "klmnopq",
- "klmnopqr",
- "klmnopqrs",
- "klmnopqrst",
- "klmnopqrstu",
- "l",
- "lm",
- "lmn",
- "lmno",
- "lmnop",
- "lmnopq",
- "lmnopqr",
- "lmnopqrs",
- "lmnopqrst",
- "lmnopqrstu",
- "m",
- "mn",
- "mno",
- "mnop",
- "mnopq",
- "mnopqr",
- "mnopqrs",
- "mnopqrst",
- "mnopqrstu",
- "n",
- "no",
- "nop",
- "nopq",
- "nopqr",
- "nopqrs",
- "nopqrst",
- "nopqrstu",
- "o",
- "op",
- "opq",
- "opqr",
- "opqrs",
- "opqrst",
- "opqrstu",
- "p",
- "pq",
- "pqr",
- "pqrs",
- "pqrst",
- "pqrstu",
- "q",
- "qr",
- "qrs",
- "qrst",
- "qrstu",
- "r",
- "rs",
- "rst",
- "rstu",
- "s",
- "st",
- "stu",
- "t",
- "tu",
- "u",
- ]
- assert blah(lista, 'abcdefghjijklmnopqrstuz')
Advertisement
Add Comment
Please, Sign In to add comment