Guest User

Untitled

a guest
Mar 16th, 2016
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.47 KB | None | 0 0
  1. def blah(strings, string):
  2.     strings = [s for s in strings if s in string]
  3.     for s in strings:
  4.         string = ''.join(string.split(s))
  5.         if not string:
  6.             return True
  7.     return False
  8.  
  9. lista = [
  10.     "a",
  11.     "ab",
  12.     "abc",
  13.     "abcd",
  14.     "abcde",
  15.     "abcdef",
  16.     "abcdefg",
  17.     "abcdefgh",
  18.     "abcdefghj",
  19.     "abcdefghji",
  20.     "abcdefghjij",
  21.     "abcdefghjijk",
  22.     "abcdefghjijkl",
  23.     "abcdefghjijklm",
  24.     "abcdefghjijklmn",
  25.     "abcdefghjijklmno",
  26.     "abcdefghjijklmnop",
  27.     "abcdefghjijklmnopq",
  28.     "abcdefghjijklmnopqr",
  29.     "abcdefghjijklmnopqrs",
  30.     "abcdefghjijklmnopqrst",
  31.     "abcdefghjijklmnopqrstu",
  32.     "b",
  33.     "bc",
  34.     "bcd",
  35.     "bcde",
  36.     "bcdef",
  37.     "bcdefg",
  38.     "bcdefgh",
  39.     "bcdefghj",
  40.     "bcdefghji",
  41.     "bcdefghjij",
  42.     "bcdefghjijk",
  43.     "bcdefghjijkl",
  44.     "bcdefghjijklm",
  45.     "bcdefghjijklmn",
  46.     "bcdefghjijklmno",
  47.     "bcdefghjijklmnop",
  48.     "bcdefghjijklmnopq",
  49.     "bcdefghjijklmnopqr",
  50.     "bcdefghjijklmnopqrs",
  51.     "bcdefghjijklmnopqrst",
  52.     "bcdefghjijklmnopqrstu",
  53.     "c",
  54.     "cd",
  55.     "cde",
  56.     "cdef",
  57.     "cdefg",
  58.     "cdefgh",
  59.     "cdefghj",
  60.     "cdefghji",
  61.     "cdefghjij",
  62.     "cdefghjijk",
  63.     "cdefghjijkl",
  64.     "cdefghjijklm",
  65.     "cdefghjijklmn",
  66.     "cdefghjijklmno",
  67.     "cdefghjijklmnop",
  68.     "cdefghjijklmnopq",
  69.     "cdefghjijklmnopqr",
  70.     "cdefghjijklmnopqrs",
  71.     "cdefghjijklmnopqrst",
  72.     "cdefghjijklmnopqrstu",
  73.     "d",
  74.     "de",
  75.     "def",
  76.     "defg",
  77.     "defgh",
  78.     "defghj",
  79.     "defghji",
  80.     "defghjij",
  81.     "defghjijk",
  82.     "defghjijkl",
  83.     "defghjijklm",
  84.     "defghjijklmn",
  85.     "defghjijklmno",
  86.     "defghjijklmnop",
  87.     "defghjijklmnopq",
  88.     "defghjijklmnopqr",
  89.     "defghjijklmnopqrs",
  90.     "defghjijklmnopqrst",
  91.     "defghjijklmnopqrstu",
  92.     "e",
  93.     "ef",
  94.     "efg",
  95.     "efgh",
  96.     "efghj",
  97.     "efghji",
  98.     "efghjij",
  99.     "efghjijk",
  100.     "efghjijkl",
  101.     "efghjijklm",
  102.     "efghjijklmn",
  103.     "efghjijklmno",
  104.     "efghjijklmnop",
  105.     "efghjijklmnopq",
  106.     "efghjijklmnopqr",
  107.     "efghjijklmnopqrs",
  108.     "efghjijklmnopqrst",
  109.     "efghjijklmnopqrstu",
  110.     "f",
  111.     "fg",
  112.     "fgh",
  113.     "fghj",
  114.     "fghji",
  115.     "fghjij",
  116.     "fghjijk",
  117.     "fghjijkl",
  118.     "fghjijklm",
  119.     "fghjijklmn",
  120.     "fghjijklmno",
  121.     "fghjijklmnop",
  122.     "fghjijklmnopq",
  123.     "fghjijklmnopqr",
  124.     "fghjijklmnopqrs",
  125.     "fghjijklmnopqrst",
  126.     "fghjijklmnopqrstu",
  127.     "g",
  128.     "gh",
  129.     "ghj",
  130.     "ghji",
  131.     "ghjij",
  132.     "ghjijk",
  133.     "ghjijkl",
  134.     "ghjijklm",
  135.     "ghjijklmn",
  136.     "ghjijklmno",
  137.     "ghjijklmnop",
  138.     "ghjijklmnopq",
  139.     "ghjijklmnopqr",
  140.     "ghjijklmnopqrs",
  141.     "ghjijklmnopqrst",
  142.     "ghjijklmnopqrstu",
  143.     "h",
  144.     "hj",
  145.     "hji",
  146.     "hjij",
  147.     "hjijk",
  148.     "hjijkl",
  149.     "hjijklm",
  150.     "hjijklmn",
  151.     "hjijklmno",
  152.     "hjijklmnop",
  153.     "hjijklmnopq",
  154.     "hjijklmnopqr",
  155.     "hjijklmnopqrs",
  156.     "hjijklmnopqrst",
  157.     "hjijklmnopqrstu",
  158.     "j",
  159.     "ji",
  160.     "jij",
  161.     "jijk",
  162.     "jijkl",
  163.     "jijklm",
  164.     "jijklmn",
  165.     "jijklmno",
  166.     "jijklmnop",
  167.     "jijklmnopq",
  168.     "jijklmnopqr",
  169.     "jijklmnopqrs",
  170.     "jijklmnopqrst",
  171.     "jijklmnopqrstu",
  172.     "i",
  173.     "ij",
  174.     "ijk",
  175.     "ijkl",
  176.     "ijklm",
  177.     "ijklmn",
  178.     "ijklmno",
  179.     "ijklmnop",
  180.     "ijklmnopq",
  181.     "ijklmnopqr",
  182.     "ijklmnopqrs",
  183.     "ijklmnopqrst",
  184.     "ijklmnopqrstu",
  185.     "j",
  186.     "jk",
  187.     "jkl",
  188.     "jklm",
  189.     "jklmn",
  190.     "jklmno",
  191.     "jklmnop",
  192.     "jklmnopq",
  193.     "jklmnopqr",
  194.     "jklmnopqrs",
  195.     "jklmnopqrst",
  196.     "jklmnopqrstu",
  197.     "k",
  198.     "kl",
  199.     "klm",
  200.     "klmn",
  201.     "klmno",
  202.     "klmnop",
  203.     "klmnopq",
  204.     "klmnopqr",
  205.     "klmnopqrs",
  206.     "klmnopqrst",
  207.     "klmnopqrstu",
  208.     "l",
  209.     "lm",
  210.     "lmn",
  211.     "lmno",
  212.     "lmnop",
  213.     "lmnopq",
  214.     "lmnopqr",
  215.     "lmnopqrs",
  216.     "lmnopqrst",
  217.     "lmnopqrstu",
  218.     "m",
  219.     "mn",
  220.     "mno",
  221.     "mnop",
  222.     "mnopq",
  223.     "mnopqr",
  224.     "mnopqrs",
  225.     "mnopqrst",
  226.     "mnopqrstu",
  227.     "n",
  228.     "no",
  229.     "nop",
  230.     "nopq",
  231.     "nopqr",
  232.     "nopqrs",
  233.     "nopqrst",
  234.     "nopqrstu",
  235.     "o",
  236.     "op",
  237.     "opq",
  238.     "opqr",
  239.     "opqrs",
  240.     "opqrst",
  241.     "opqrstu",
  242.     "p",
  243.     "pq",
  244.     "pqr",
  245.     "pqrs",
  246.     "pqrst",
  247.     "pqrstu",
  248.     "q",
  249.     "qr",
  250.     "qrs",
  251.     "qrst",
  252.     "qrstu",
  253.     "r",
  254.     "rs",
  255.     "rst",
  256.     "rstu",
  257.     "s",
  258.     "st",
  259.     "stu",
  260.     "t",
  261.     "tu",
  262.     "u",
  263. ]
  264. assert blah(lista, 'abcdefghjijklmnopqrstuz')
Advertisement
Add Comment
Please, Sign In to add comment