Crack the bank account's password!Tips for golfing in PythonIs string X a subsequence of string Y?Random...

What does an unprocessed RAW file look like?

Insecure private-key encryption

How to not let the Identify spell spoil everything?

Buying a "Used" Router

Minimum Viable Product for RTS game?

"Starve to death" Vs. "Starve to the point of death"

Coworker asking me to not bring cakes due to self control issue. What should I do?

Besides PR credit, does diversity provide anything that meritocracy does not?

why typing a variable (or expression) prints the value to stdout?

Count repetitions of an array

Allow console draw poker game to output more hands

Renting a 2CV in France

Co-worker sabotaging/undoing my work (software development)

How can I prevent an oracle who can see into the past from knowing everything that has happened?

Is the fingering of thirds flexible or do I have to follow the rules?

Prevent Nautilus / Nemo from creating .Trash-1000 folder in mounted devices

What is a good way to explain how a character can produce flames from their body?

Caron Accent v{a} doesn't render without usepackage{xeCJK}

Democratic Socialism vs Social Democracy

Why didn't Tom Riddle take the presence of Fawkes and the Sorting Hat as more of a threat?

How do you get out of your own psychology to write characters?

How to politely refuse in-office gym instructor for steroids and protein

Writing dialogues for characters whose first language is not English

Case protection with emphasis in biblatex



Crack the bank account's password!


Tips for golfing in PythonIs string X a subsequence of string Y?Random Password GeneratorGuess my password! (Code Golf)PNZ (Guess 3 unique digits in order)On the Subject of PasswordsCan you find the villain's password?I copied my password to the clipboard! Can you delete it?The bunker of the math lecturerGenerating an adequate passwordHelp! I forgot my password!Password Bishop Goodness













52












$begingroup$


Introduction



In order to prevent keyloggers from stealing a user's password, a certain bank account system has implemented the following security measure: only certain digits are prompted to be entered each time.



For example, say your target's password is 89097, the system may prompt them to enter the 2nd, 4th and 5th digit:



997



Or it might prompt them to enter the 1st, 3rd and 5th digit:



807



All you know is that your target entered the digits in order, but you don't know which position they belong to in the actual password. All you know is there are two 9s, which must come before 7; and that 8 comes before 0, and 0 before 7. Therefore, there are six possible passwords:



80997
89097
89907
98097
98907
99807


The keylogger in your target's computer has been collecting password inputs for months now, so let's hack in!



Challenge



Given a list of three-digit inputs, output all the possible passwords that are valid for all inputs. In order to reduce computational complexity and to keep the amount of possible results low, the password is guaranteed to be numerical and have a fixed size of 5. The digits in every input are in order: if it's 123, the target typed 1 first, then 2, then 3.



Input/Output examples



|----------------------|--------------------------------------------|
| Input | Output |
|----------------------|--------------------------------------------|
| [320, 723, 730] | [37230, 72320, 73203, 73230] |
| [374, 842] | [37842, 38742, 83742] |
| [010, 103, 301] | [30103] |
| [123, 124, 125, 235] | [12345, 12354, 12435] |
| [239, 944] | [23944] |
| [111, 120] | [11201, 11120, 11210, 12011, 12110, 12101] |
| [456, 789] | [] |
| [756, 586] | [07586, 17586, 27586, 37586, 47586, 57586, 57856, 58756, 67586, 70586, 71586, 72586, 73586, 74586, 75086, 75186, 75286, 75386, 75486, 75586, 75686, 75786, 75806, 75816, 75826, 75836, 75846, 75856, 75860, 75861, 75862, 75863, 75864, 75865, 75866, 75867, 75868, 75869, 75876, 75886, 75896, 75986, 76586, 77586, 78586, 79586, 87586, 97586] |
| [123] | [00123, 01023, 01123, 01203, 01213, 01223, 01230, 01231, 01232, 01233, 01234, 01235, 01236, 01237, 01238, 01239, 01243, 01253, 01263, 01273, 01283, 01293, 01323, 01423, 01523, 01623, 01723, 01823, 01923, 02123, 03123, 04123, 05123, 06123, 07123, 08123, 09123, 10023, 10123, 10203, 10213, 10223, 10230, 10231, 10232, 10233, 10234, 10235, 10236, 10237, 10238, 10239, 10243, 10253, 10263, 10273, 10283, 10293, 10323, 10423, 10523, 10623, 10723, 10823, 10923, 11023, 11123, 11203, 11213, 11223, 11230, 11231, 11232, 11233, 11234, 11235, 11236, 11237, 11238, 11239, 11243, 11253, 11263, 11273, 11283, 11293, 11323, 11423, 11523, 11623, 11723, 11823, 11923, 12003, 12013, 12023, 12030, 12031, 12032, 12033, 12034, 12035, 12036, 12037, 12038, 12039, 12043, 12053, 12063, 12073, 12083, 12093, 12103, 12113, 12123, 12130, 12131, 12132, 12133, 12134, 12135, 12136, 12137, 12138, 12139, 12143, 12153, 12163, 12173, 12183, 12193, 12203, 12213, 12223, 12230, 12231, 12232, 12233, 12234, 12235, 12236, 12237, 12238, 12239, 12243, 12253, 12263, 12273, 12283, 12293, 12300, 12301, 12302, 12303, 12304, 12305, 12306, 12307, 12308, 12309, 12310, 12311, 12312, 12313, 12314, 12315, 12316, 12317, 12318, 12319, 12320, 12321, 12322, 12323, 12324, 12325, 12326, 12327, 12328, 12329, 12330, 12331, 12332, 12333, 12334, 12335, 12336, 12337, 12338, 12339, 12340, 12341, 12342, 12343, 12344, 12345, 12346, 12347, 12348, 12349, 12350, 12351, 12352, 12353, 12354, 12355, 12356, 12357, 12358, 12359, 12360, 12361, 12362, 12363, 12364, 12365, 12366, 12367, 12368, 12369, 12370, 12371, 12372, 12373, 12374, 12375, 12376, 12377, 12378, 12379, 12380, 12381, 12382, 12383, 12384, 12385, 12386, 12387, 12388, 12389, 12390, 12391, 12392, 12393, 12394, 12395, 12396, 12397, 12398, 12399, 12403, 12413, 12423, 12430, 12431, 12432, 12433, 12434, 12435, 12436, 12437, 12438, 12439, 12443, 12453, 12463, 12473, 12483, 12493, 12503, 12513, 12523, 12530, 12531, 12532, 12533, 12534, 12535, 12536, 12537, 12538, 12539, 12543, 12553, 12563, 12573, 12583, 12593, 12603, 12613, 12623, 12630, 12631, 12632, 12633, 12634, 12635, 12636, 12637, 12638, 12639, 12643, 12653, 12663, 12673, 12683, 12693, 12703, 12713, 12723, 12730, 12731, 12732, 12733, 12734, 12735, 12736, 12737, 12738, 12739, 12743, 12753, 12763, 12773, 12783, 12793, 12803, 12813, 12823, 12830, 12831, 12832, 12833, 12834, 12835, 12836, 12837, 12838, 12839, 12843, 12853, 12863, 12873, 12883, 12893, 12903, 12913, 12923, 12930, 12931, 12932, 12933, 12934, 12935, 12936, 12937, 12938, 12939, 12943, 12953, 12963, 12973, 12983, 12993, 13023, 13123, 13203, 13213, 13223, 13230, 13231, 13232, 13233, 13234, 13235, 13236, 13237, 13238, 13239, 13243, 13253, 13263, 13273, 13283, 13293, 13323, 13423, 13523, 13623, 13723, 13823, 13923, 14023, 14123, 14203, 14213, 14223, 14230, 14231, 14232, 14233, 14234, 14235, 14236, 14237, 14238, 14239, 14243, 14253, 14263, 14273, 14283, 14293, 14323, 14423, 14523, 14623, 14723, 14823, 14923, 15023, 15123, 15203, 15213, 15223, 15230, 15231, 15232, 15233, 15234, 15235, 15236, 15237, 15238, 15239, 15243, 15253, 15263, 15273, 15283, 15293, 15323, 15423, 15523, 15623, 15723, 15823, 15923, 16023, 16123, 16203, 16213, 16223, 16230, 16231, 16232, 16233, 16234, 16235, 16236, 16237, 16238, 16239, 16243, 16253, 16263, 16273, 16283, 16293, 16323, 16423, 16523, 16623, 16723, 16823, 16923, 17023, 17123, 17203, 17213, 17223, 17230, 17231, 17232, 17233, 17234, 17235, 17236, 17237, 17238, 17239, 17243, 17253, 17263, 17273, 17283, 17293, 17323, 17423, 17523, 17623, 17723, 17823, 17923, 18023, 18123, 18203, 18213, 18223, 18230, 18231, 18232, 18233, 18234, 18235, 18236, 18237, 18238, 18239, 18243, 18253, 18263, 18273, 18283, 18293, 18323, 18423, 18523, 18623, 18723, 18823, 18923, 19023, 19123, 19203, 19213, 19223, 19230, 19231, 19232, 19233, 19234, 19235, 19236, 19237, 19238, 19239, 19243, 19253, 19263, 19273, 19283, 19293, 19323, 19423, 19523, 19623, 19723, 19823, 19923, 20123, 21023, 21123, 21203, 21213, 21223, 21230, 21231, 21232, 21233, 21234, 21235, 21236, 21237, 21238, 21239, 21243, 21253, 21263, 21273, 21283, 21293, 21323, 21423, 21523, 21623, 21723, 21823, 21923, 22123, 23123, 24123, 25123, 26123, 27123, 28123, 29123, 30123, 31023, 31123, 31203, 31213, 31223, 31230, 31231, 31232, 31233, 31234, 31235, 31236, 31237, 31238, 31239, 31243, 31253, 31263, 31273, 31283, 31293, 31323, 31423, 31523, 31623, 31723, 31823, 31923, 32123, 33123, 34123, 35123, 36123, 37123, 38123, 39123, 40123, 41023, 41123, 41203, 41213, 41223, 41230, 41231, 41232, 41233, 41234, 41235, 41236, 41237, 41238, 41239, 41243, 41253, 41263, 41273, 41283, 41293, 41323, 41423, 41523, 41623, 41723, 41823, 41923, 42123, 43123, 44123, 45123, 46123, 47123, 48123, 49123, 50123, 51023, 51123, 51203, 51213, 51223, 51230, 51231, 51232, 51233, 51234, 51235, 51236, 51237, 51238, 51239, 51243, 51253, 51263, 51273, 51283, 51293, 51323, 51423, 51523, 51623, 51723, 51823, 51923, 52123, 53123, 54123, 55123, 56123, 57123, 58123, 59123, 60123, 61023, 61123, 61203, 61213, 61223, 61230, 61231, 61232, 61233, 61234, 61235, 61236, 61237, 61238, 61239, 61243, 61253, 61263, 61273, 61283, 61293, 61323, 61423, 61523, 61623, 61723, 61823, 61923, 62123, 63123, 64123, 65123, 66123, 67123, 68123, 69123, 70123, 71023, 71123, 71203, 71213, 71223, 71230, 71231, 71232, 71233, 71234, 71235, 71236, 71237, 71238, 71239, 71243, 71253, 71263, 71273, 71283, 71293, 71323, 71423, 71523, 71623, 71723, 71823, 71923, 72123, 73123, 74123, 75123, 76123, 77123, 78123, 79123, 80123, 81023, 81123, 81203, 81213, 81223, 81230, 81231, 81232, 81233, 81234, 81235, 81236, 81237, 81238, 81239, 81243, 81253, 81263, 81273, 81283, 81293, 81323, 81423, 81523, 81623, 81723, 81823, 81923, 82123, 83123, 84123, 85123, 86123, 87123, 88123, 89123, 90123, 91023, 91123, 91203, 91213, 91223, 91230, 91231, 91232, 91233, 91234, 91235, 91236, 91237, 91238, 91239, 91243, 91253, 91263, 91273, 91283, 91293, 91323, 91423, 91523, 91623, 91723, 91823, 91923, 92123, 93123, 94123, 95123, 96123, 97123, 98123, 99123] |
|----------------------|--------------------------------------------|




Rules




  • Input is guaranteed non-empty.

  • Leading and trailing zeros matter: 01234 is different from 12340, and 1234 doesn't crack either password. Think of how real passwords work!


  • Standard I/O rules apply.

  • No standard loopholes.

  • This is code-golf, so the shortest answer in bytes wins. Non-codegolfing languages are welcome!










share|improve this question









New contributor




cefel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$








  • 5




    $begingroup$
    Are the digits always in order? Based on the test cases I assume they are, but I couldn't see it mentioned in the rules unless I read past it.
    $endgroup$
    – Kevin Cruijssen
    2 days ago






  • 13




    $begingroup$
    Welcome to PPCG! This is a nice, well-structured, and neatly formatted first challenge. You've clearly done your homework as far as getting that all down. I'm looking forward to answering it (if someone doesn't answer it in R first!). In the future, we suggest using the sandbox to get feedback before posting to main. Hope you enjoy your time on PPCG!
    $endgroup$
    – Giuseppe
    2 days ago








  • 1




    $begingroup$
    @Giuseppe thanks! I've been anonymously reading the questions on this site for years, and I've been writing and tweaking and actually solving this specific problem for a couple months: I liked it enough to skip the sandbox. I'll post there first next time!
    $endgroup$
    – cefel
    2 days ago








  • 2




    $begingroup$
    @Arnauld Well, if your password is 01234 or 12340 you shouldn't be able to log in by typing 1234. Passwords are more a string than a number even if composed by numbers, at least in that sense. So yes, leading and trailing zeros are mandatory.
    $endgroup$
    – cefel
    2 days ago








  • 2




    $begingroup$
    The final test case appears to be missing 22123... unless I'm misunderstanding something?
    $endgroup$
    – Jonah
    2 days ago
















52












$begingroup$


Introduction



In order to prevent keyloggers from stealing a user's password, a certain bank account system has implemented the following security measure: only certain digits are prompted to be entered each time.



For example, say your target's password is 89097, the system may prompt them to enter the 2nd, 4th and 5th digit:



997



Or it might prompt them to enter the 1st, 3rd and 5th digit:



807



All you know is that your target entered the digits in order, but you don't know which position they belong to in the actual password. All you know is there are two 9s, which must come before 7; and that 8 comes before 0, and 0 before 7. Therefore, there are six possible passwords:



80997
89097
89907
98097
98907
99807


The keylogger in your target's computer has been collecting password inputs for months now, so let's hack in!



Challenge



Given a list of three-digit inputs, output all the possible passwords that are valid for all inputs. In order to reduce computational complexity and to keep the amount of possible results low, the password is guaranteed to be numerical and have a fixed size of 5. The digits in every input are in order: if it's 123, the target typed 1 first, then 2, then 3.



Input/Output examples



|----------------------|--------------------------------------------|
| Input | Output |
|----------------------|--------------------------------------------|
| [320, 723, 730] | [37230, 72320, 73203, 73230] |
| [374, 842] | [37842, 38742, 83742] |
| [010, 103, 301] | [30103] |
| [123, 124, 125, 235] | [12345, 12354, 12435] |
| [239, 944] | [23944] |
| [111, 120] | [11201, 11120, 11210, 12011, 12110, 12101] |
| [456, 789] | [] |
| [756, 586] | [07586, 17586, 27586, 37586, 47586, 57586, 57856, 58756, 67586, 70586, 71586, 72586, 73586, 74586, 75086, 75186, 75286, 75386, 75486, 75586, 75686, 75786, 75806, 75816, 75826, 75836, 75846, 75856, 75860, 75861, 75862, 75863, 75864, 75865, 75866, 75867, 75868, 75869, 75876, 75886, 75896, 75986, 76586, 77586, 78586, 79586, 87586, 97586] |
| [123] | [00123, 01023, 01123, 01203, 01213, 01223, 01230, 01231, 01232, 01233, 01234, 01235, 01236, 01237, 01238, 01239, 01243, 01253, 01263, 01273, 01283, 01293, 01323, 01423, 01523, 01623, 01723, 01823, 01923, 02123, 03123, 04123, 05123, 06123, 07123, 08123, 09123, 10023, 10123, 10203, 10213, 10223, 10230, 10231, 10232, 10233, 10234, 10235, 10236, 10237, 10238, 10239, 10243, 10253, 10263, 10273, 10283, 10293, 10323, 10423, 10523, 10623, 10723, 10823, 10923, 11023, 11123, 11203, 11213, 11223, 11230, 11231, 11232, 11233, 11234, 11235, 11236, 11237, 11238, 11239, 11243, 11253, 11263, 11273, 11283, 11293, 11323, 11423, 11523, 11623, 11723, 11823, 11923, 12003, 12013, 12023, 12030, 12031, 12032, 12033, 12034, 12035, 12036, 12037, 12038, 12039, 12043, 12053, 12063, 12073, 12083, 12093, 12103, 12113, 12123, 12130, 12131, 12132, 12133, 12134, 12135, 12136, 12137, 12138, 12139, 12143, 12153, 12163, 12173, 12183, 12193, 12203, 12213, 12223, 12230, 12231, 12232, 12233, 12234, 12235, 12236, 12237, 12238, 12239, 12243, 12253, 12263, 12273, 12283, 12293, 12300, 12301, 12302, 12303, 12304, 12305, 12306, 12307, 12308, 12309, 12310, 12311, 12312, 12313, 12314, 12315, 12316, 12317, 12318, 12319, 12320, 12321, 12322, 12323, 12324, 12325, 12326, 12327, 12328, 12329, 12330, 12331, 12332, 12333, 12334, 12335, 12336, 12337, 12338, 12339, 12340, 12341, 12342, 12343, 12344, 12345, 12346, 12347, 12348, 12349, 12350, 12351, 12352, 12353, 12354, 12355, 12356, 12357, 12358, 12359, 12360, 12361, 12362, 12363, 12364, 12365, 12366, 12367, 12368, 12369, 12370, 12371, 12372, 12373, 12374, 12375, 12376, 12377, 12378, 12379, 12380, 12381, 12382, 12383, 12384, 12385, 12386, 12387, 12388, 12389, 12390, 12391, 12392, 12393, 12394, 12395, 12396, 12397, 12398, 12399, 12403, 12413, 12423, 12430, 12431, 12432, 12433, 12434, 12435, 12436, 12437, 12438, 12439, 12443, 12453, 12463, 12473, 12483, 12493, 12503, 12513, 12523, 12530, 12531, 12532, 12533, 12534, 12535, 12536, 12537, 12538, 12539, 12543, 12553, 12563, 12573, 12583, 12593, 12603, 12613, 12623, 12630, 12631, 12632, 12633, 12634, 12635, 12636, 12637, 12638, 12639, 12643, 12653, 12663, 12673, 12683, 12693, 12703, 12713, 12723, 12730, 12731, 12732, 12733, 12734, 12735, 12736, 12737, 12738, 12739, 12743, 12753, 12763, 12773, 12783, 12793, 12803, 12813, 12823, 12830, 12831, 12832, 12833, 12834, 12835, 12836, 12837, 12838, 12839, 12843, 12853, 12863, 12873, 12883, 12893, 12903, 12913, 12923, 12930, 12931, 12932, 12933, 12934, 12935, 12936, 12937, 12938, 12939, 12943, 12953, 12963, 12973, 12983, 12993, 13023, 13123, 13203, 13213, 13223, 13230, 13231, 13232, 13233, 13234, 13235, 13236, 13237, 13238, 13239, 13243, 13253, 13263, 13273, 13283, 13293, 13323, 13423, 13523, 13623, 13723, 13823, 13923, 14023, 14123, 14203, 14213, 14223, 14230, 14231, 14232, 14233, 14234, 14235, 14236, 14237, 14238, 14239, 14243, 14253, 14263, 14273, 14283, 14293, 14323, 14423, 14523, 14623, 14723, 14823, 14923, 15023, 15123, 15203, 15213, 15223, 15230, 15231, 15232, 15233, 15234, 15235, 15236, 15237, 15238, 15239, 15243, 15253, 15263, 15273, 15283, 15293, 15323, 15423, 15523, 15623, 15723, 15823, 15923, 16023, 16123, 16203, 16213, 16223, 16230, 16231, 16232, 16233, 16234, 16235, 16236, 16237, 16238, 16239, 16243, 16253, 16263, 16273, 16283, 16293, 16323, 16423, 16523, 16623, 16723, 16823, 16923, 17023, 17123, 17203, 17213, 17223, 17230, 17231, 17232, 17233, 17234, 17235, 17236, 17237, 17238, 17239, 17243, 17253, 17263, 17273, 17283, 17293, 17323, 17423, 17523, 17623, 17723, 17823, 17923, 18023, 18123, 18203, 18213, 18223, 18230, 18231, 18232, 18233, 18234, 18235, 18236, 18237, 18238, 18239, 18243, 18253, 18263, 18273, 18283, 18293, 18323, 18423, 18523, 18623, 18723, 18823, 18923, 19023, 19123, 19203, 19213, 19223, 19230, 19231, 19232, 19233, 19234, 19235, 19236, 19237, 19238, 19239, 19243, 19253, 19263, 19273, 19283, 19293, 19323, 19423, 19523, 19623, 19723, 19823, 19923, 20123, 21023, 21123, 21203, 21213, 21223, 21230, 21231, 21232, 21233, 21234, 21235, 21236, 21237, 21238, 21239, 21243, 21253, 21263, 21273, 21283, 21293, 21323, 21423, 21523, 21623, 21723, 21823, 21923, 22123, 23123, 24123, 25123, 26123, 27123, 28123, 29123, 30123, 31023, 31123, 31203, 31213, 31223, 31230, 31231, 31232, 31233, 31234, 31235, 31236, 31237, 31238, 31239, 31243, 31253, 31263, 31273, 31283, 31293, 31323, 31423, 31523, 31623, 31723, 31823, 31923, 32123, 33123, 34123, 35123, 36123, 37123, 38123, 39123, 40123, 41023, 41123, 41203, 41213, 41223, 41230, 41231, 41232, 41233, 41234, 41235, 41236, 41237, 41238, 41239, 41243, 41253, 41263, 41273, 41283, 41293, 41323, 41423, 41523, 41623, 41723, 41823, 41923, 42123, 43123, 44123, 45123, 46123, 47123, 48123, 49123, 50123, 51023, 51123, 51203, 51213, 51223, 51230, 51231, 51232, 51233, 51234, 51235, 51236, 51237, 51238, 51239, 51243, 51253, 51263, 51273, 51283, 51293, 51323, 51423, 51523, 51623, 51723, 51823, 51923, 52123, 53123, 54123, 55123, 56123, 57123, 58123, 59123, 60123, 61023, 61123, 61203, 61213, 61223, 61230, 61231, 61232, 61233, 61234, 61235, 61236, 61237, 61238, 61239, 61243, 61253, 61263, 61273, 61283, 61293, 61323, 61423, 61523, 61623, 61723, 61823, 61923, 62123, 63123, 64123, 65123, 66123, 67123, 68123, 69123, 70123, 71023, 71123, 71203, 71213, 71223, 71230, 71231, 71232, 71233, 71234, 71235, 71236, 71237, 71238, 71239, 71243, 71253, 71263, 71273, 71283, 71293, 71323, 71423, 71523, 71623, 71723, 71823, 71923, 72123, 73123, 74123, 75123, 76123, 77123, 78123, 79123, 80123, 81023, 81123, 81203, 81213, 81223, 81230, 81231, 81232, 81233, 81234, 81235, 81236, 81237, 81238, 81239, 81243, 81253, 81263, 81273, 81283, 81293, 81323, 81423, 81523, 81623, 81723, 81823, 81923, 82123, 83123, 84123, 85123, 86123, 87123, 88123, 89123, 90123, 91023, 91123, 91203, 91213, 91223, 91230, 91231, 91232, 91233, 91234, 91235, 91236, 91237, 91238, 91239, 91243, 91253, 91263, 91273, 91283, 91293, 91323, 91423, 91523, 91623, 91723, 91823, 91923, 92123, 93123, 94123, 95123, 96123, 97123, 98123, 99123] |
|----------------------|--------------------------------------------|




Rules




  • Input is guaranteed non-empty.

  • Leading and trailing zeros matter: 01234 is different from 12340, and 1234 doesn't crack either password. Think of how real passwords work!


  • Standard I/O rules apply.

  • No standard loopholes.

  • This is code-golf, so the shortest answer in bytes wins. Non-codegolfing languages are welcome!










share|improve this question









New contributor




cefel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$








  • 5




    $begingroup$
    Are the digits always in order? Based on the test cases I assume they are, but I couldn't see it mentioned in the rules unless I read past it.
    $endgroup$
    – Kevin Cruijssen
    2 days ago






  • 13




    $begingroup$
    Welcome to PPCG! This is a nice, well-structured, and neatly formatted first challenge. You've clearly done your homework as far as getting that all down. I'm looking forward to answering it (if someone doesn't answer it in R first!). In the future, we suggest using the sandbox to get feedback before posting to main. Hope you enjoy your time on PPCG!
    $endgroup$
    – Giuseppe
    2 days ago








  • 1




    $begingroup$
    @Giuseppe thanks! I've been anonymously reading the questions on this site for years, and I've been writing and tweaking and actually solving this specific problem for a couple months: I liked it enough to skip the sandbox. I'll post there first next time!
    $endgroup$
    – cefel
    2 days ago








  • 2




    $begingroup$
    @Arnauld Well, if your password is 01234 or 12340 you shouldn't be able to log in by typing 1234. Passwords are more a string than a number even if composed by numbers, at least in that sense. So yes, leading and trailing zeros are mandatory.
    $endgroup$
    – cefel
    2 days ago








  • 2




    $begingroup$
    The final test case appears to be missing 22123... unless I'm misunderstanding something?
    $endgroup$
    – Jonah
    2 days ago














52












52








52


6



$begingroup$


Introduction



In order to prevent keyloggers from stealing a user's password, a certain bank account system has implemented the following security measure: only certain digits are prompted to be entered each time.



For example, say your target's password is 89097, the system may prompt them to enter the 2nd, 4th and 5th digit:



997



Or it might prompt them to enter the 1st, 3rd and 5th digit:



807



All you know is that your target entered the digits in order, but you don't know which position they belong to in the actual password. All you know is there are two 9s, which must come before 7; and that 8 comes before 0, and 0 before 7. Therefore, there are six possible passwords:



80997
89097
89907
98097
98907
99807


The keylogger in your target's computer has been collecting password inputs for months now, so let's hack in!



Challenge



Given a list of three-digit inputs, output all the possible passwords that are valid for all inputs. In order to reduce computational complexity and to keep the amount of possible results low, the password is guaranteed to be numerical and have a fixed size of 5. The digits in every input are in order: if it's 123, the target typed 1 first, then 2, then 3.



Input/Output examples



|----------------------|--------------------------------------------|
| Input | Output |
|----------------------|--------------------------------------------|
| [320, 723, 730] | [37230, 72320, 73203, 73230] |
| [374, 842] | [37842, 38742, 83742] |
| [010, 103, 301] | [30103] |
| [123, 124, 125, 235] | [12345, 12354, 12435] |
| [239, 944] | [23944] |
| [111, 120] | [11201, 11120, 11210, 12011, 12110, 12101] |
| [456, 789] | [] |
| [756, 586] | [07586, 17586, 27586, 37586, 47586, 57586, 57856, 58756, 67586, 70586, 71586, 72586, 73586, 74586, 75086, 75186, 75286, 75386, 75486, 75586, 75686, 75786, 75806, 75816, 75826, 75836, 75846, 75856, 75860, 75861, 75862, 75863, 75864, 75865, 75866, 75867, 75868, 75869, 75876, 75886, 75896, 75986, 76586, 77586, 78586, 79586, 87586, 97586] |
| [123] | [00123, 01023, 01123, 01203, 01213, 01223, 01230, 01231, 01232, 01233, 01234, 01235, 01236, 01237, 01238, 01239, 01243, 01253, 01263, 01273, 01283, 01293, 01323, 01423, 01523, 01623, 01723, 01823, 01923, 02123, 03123, 04123, 05123, 06123, 07123, 08123, 09123, 10023, 10123, 10203, 10213, 10223, 10230, 10231, 10232, 10233, 10234, 10235, 10236, 10237, 10238, 10239, 10243, 10253, 10263, 10273, 10283, 10293, 10323, 10423, 10523, 10623, 10723, 10823, 10923, 11023, 11123, 11203, 11213, 11223, 11230, 11231, 11232, 11233, 11234, 11235, 11236, 11237, 11238, 11239, 11243, 11253, 11263, 11273, 11283, 11293, 11323, 11423, 11523, 11623, 11723, 11823, 11923, 12003, 12013, 12023, 12030, 12031, 12032, 12033, 12034, 12035, 12036, 12037, 12038, 12039, 12043, 12053, 12063, 12073, 12083, 12093, 12103, 12113, 12123, 12130, 12131, 12132, 12133, 12134, 12135, 12136, 12137, 12138, 12139, 12143, 12153, 12163, 12173, 12183, 12193, 12203, 12213, 12223, 12230, 12231, 12232, 12233, 12234, 12235, 12236, 12237, 12238, 12239, 12243, 12253, 12263, 12273, 12283, 12293, 12300, 12301, 12302, 12303, 12304, 12305, 12306, 12307, 12308, 12309, 12310, 12311, 12312, 12313, 12314, 12315, 12316, 12317, 12318, 12319, 12320, 12321, 12322, 12323, 12324, 12325, 12326, 12327, 12328, 12329, 12330, 12331, 12332, 12333, 12334, 12335, 12336, 12337, 12338, 12339, 12340, 12341, 12342, 12343, 12344, 12345, 12346, 12347, 12348, 12349, 12350, 12351, 12352, 12353, 12354, 12355, 12356, 12357, 12358, 12359, 12360, 12361, 12362, 12363, 12364, 12365, 12366, 12367, 12368, 12369, 12370, 12371, 12372, 12373, 12374, 12375, 12376, 12377, 12378, 12379, 12380, 12381, 12382, 12383, 12384, 12385, 12386, 12387, 12388, 12389, 12390, 12391, 12392, 12393, 12394, 12395, 12396, 12397, 12398, 12399, 12403, 12413, 12423, 12430, 12431, 12432, 12433, 12434, 12435, 12436, 12437, 12438, 12439, 12443, 12453, 12463, 12473, 12483, 12493, 12503, 12513, 12523, 12530, 12531, 12532, 12533, 12534, 12535, 12536, 12537, 12538, 12539, 12543, 12553, 12563, 12573, 12583, 12593, 12603, 12613, 12623, 12630, 12631, 12632, 12633, 12634, 12635, 12636, 12637, 12638, 12639, 12643, 12653, 12663, 12673, 12683, 12693, 12703, 12713, 12723, 12730, 12731, 12732, 12733, 12734, 12735, 12736, 12737, 12738, 12739, 12743, 12753, 12763, 12773, 12783, 12793, 12803, 12813, 12823, 12830, 12831, 12832, 12833, 12834, 12835, 12836, 12837, 12838, 12839, 12843, 12853, 12863, 12873, 12883, 12893, 12903, 12913, 12923, 12930, 12931, 12932, 12933, 12934, 12935, 12936, 12937, 12938, 12939, 12943, 12953, 12963, 12973, 12983, 12993, 13023, 13123, 13203, 13213, 13223, 13230, 13231, 13232, 13233, 13234, 13235, 13236, 13237, 13238, 13239, 13243, 13253, 13263, 13273, 13283, 13293, 13323, 13423, 13523, 13623, 13723, 13823, 13923, 14023, 14123, 14203, 14213, 14223, 14230, 14231, 14232, 14233, 14234, 14235, 14236, 14237, 14238, 14239, 14243, 14253, 14263, 14273, 14283, 14293, 14323, 14423, 14523, 14623, 14723, 14823, 14923, 15023, 15123, 15203, 15213, 15223, 15230, 15231, 15232, 15233, 15234, 15235, 15236, 15237, 15238, 15239, 15243, 15253, 15263, 15273, 15283, 15293, 15323, 15423, 15523, 15623, 15723, 15823, 15923, 16023, 16123, 16203, 16213, 16223, 16230, 16231, 16232, 16233, 16234, 16235, 16236, 16237, 16238, 16239, 16243, 16253, 16263, 16273, 16283, 16293, 16323, 16423, 16523, 16623, 16723, 16823, 16923, 17023, 17123, 17203, 17213, 17223, 17230, 17231, 17232, 17233, 17234, 17235, 17236, 17237, 17238, 17239, 17243, 17253, 17263, 17273, 17283, 17293, 17323, 17423, 17523, 17623, 17723, 17823, 17923, 18023, 18123, 18203, 18213, 18223, 18230, 18231, 18232, 18233, 18234, 18235, 18236, 18237, 18238, 18239, 18243, 18253, 18263, 18273, 18283, 18293, 18323, 18423, 18523, 18623, 18723, 18823, 18923, 19023, 19123, 19203, 19213, 19223, 19230, 19231, 19232, 19233, 19234, 19235, 19236, 19237, 19238, 19239, 19243, 19253, 19263, 19273, 19283, 19293, 19323, 19423, 19523, 19623, 19723, 19823, 19923, 20123, 21023, 21123, 21203, 21213, 21223, 21230, 21231, 21232, 21233, 21234, 21235, 21236, 21237, 21238, 21239, 21243, 21253, 21263, 21273, 21283, 21293, 21323, 21423, 21523, 21623, 21723, 21823, 21923, 22123, 23123, 24123, 25123, 26123, 27123, 28123, 29123, 30123, 31023, 31123, 31203, 31213, 31223, 31230, 31231, 31232, 31233, 31234, 31235, 31236, 31237, 31238, 31239, 31243, 31253, 31263, 31273, 31283, 31293, 31323, 31423, 31523, 31623, 31723, 31823, 31923, 32123, 33123, 34123, 35123, 36123, 37123, 38123, 39123, 40123, 41023, 41123, 41203, 41213, 41223, 41230, 41231, 41232, 41233, 41234, 41235, 41236, 41237, 41238, 41239, 41243, 41253, 41263, 41273, 41283, 41293, 41323, 41423, 41523, 41623, 41723, 41823, 41923, 42123, 43123, 44123, 45123, 46123, 47123, 48123, 49123, 50123, 51023, 51123, 51203, 51213, 51223, 51230, 51231, 51232, 51233, 51234, 51235, 51236, 51237, 51238, 51239, 51243, 51253, 51263, 51273, 51283, 51293, 51323, 51423, 51523, 51623, 51723, 51823, 51923, 52123, 53123, 54123, 55123, 56123, 57123, 58123, 59123, 60123, 61023, 61123, 61203, 61213, 61223, 61230, 61231, 61232, 61233, 61234, 61235, 61236, 61237, 61238, 61239, 61243, 61253, 61263, 61273, 61283, 61293, 61323, 61423, 61523, 61623, 61723, 61823, 61923, 62123, 63123, 64123, 65123, 66123, 67123, 68123, 69123, 70123, 71023, 71123, 71203, 71213, 71223, 71230, 71231, 71232, 71233, 71234, 71235, 71236, 71237, 71238, 71239, 71243, 71253, 71263, 71273, 71283, 71293, 71323, 71423, 71523, 71623, 71723, 71823, 71923, 72123, 73123, 74123, 75123, 76123, 77123, 78123, 79123, 80123, 81023, 81123, 81203, 81213, 81223, 81230, 81231, 81232, 81233, 81234, 81235, 81236, 81237, 81238, 81239, 81243, 81253, 81263, 81273, 81283, 81293, 81323, 81423, 81523, 81623, 81723, 81823, 81923, 82123, 83123, 84123, 85123, 86123, 87123, 88123, 89123, 90123, 91023, 91123, 91203, 91213, 91223, 91230, 91231, 91232, 91233, 91234, 91235, 91236, 91237, 91238, 91239, 91243, 91253, 91263, 91273, 91283, 91293, 91323, 91423, 91523, 91623, 91723, 91823, 91923, 92123, 93123, 94123, 95123, 96123, 97123, 98123, 99123] |
|----------------------|--------------------------------------------|




Rules




  • Input is guaranteed non-empty.

  • Leading and trailing zeros matter: 01234 is different from 12340, and 1234 doesn't crack either password. Think of how real passwords work!


  • Standard I/O rules apply.

  • No standard loopholes.

  • This is code-golf, so the shortest answer in bytes wins. Non-codegolfing languages are welcome!










share|improve this question









New contributor




cefel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.







$endgroup$




Introduction



In order to prevent keyloggers from stealing a user's password, a certain bank account system has implemented the following security measure: only certain digits are prompted to be entered each time.



For example, say your target's password is 89097, the system may prompt them to enter the 2nd, 4th and 5th digit:



997



Or it might prompt them to enter the 1st, 3rd and 5th digit:



807



All you know is that your target entered the digits in order, but you don't know which position they belong to in the actual password. All you know is there are two 9s, which must come before 7; and that 8 comes before 0, and 0 before 7. Therefore, there are six possible passwords:



80997
89097
89907
98097
98907
99807


The keylogger in your target's computer has been collecting password inputs for months now, so let's hack in!



Challenge



Given a list of three-digit inputs, output all the possible passwords that are valid for all inputs. In order to reduce computational complexity and to keep the amount of possible results low, the password is guaranteed to be numerical and have a fixed size of 5. The digits in every input are in order: if it's 123, the target typed 1 first, then 2, then 3.



Input/Output examples



|----------------------|--------------------------------------------|
| Input | Output |
|----------------------|--------------------------------------------|
| [320, 723, 730] | [37230, 72320, 73203, 73230] |
| [374, 842] | [37842, 38742, 83742] |
| [010, 103, 301] | [30103] |
| [123, 124, 125, 235] | [12345, 12354, 12435] |
| [239, 944] | [23944] |
| [111, 120] | [11201, 11120, 11210, 12011, 12110, 12101] |
| [456, 789] | [] |
| [756, 586] | [07586, 17586, 27586, 37586, 47586, 57586, 57856, 58756, 67586, 70586, 71586, 72586, 73586, 74586, 75086, 75186, 75286, 75386, 75486, 75586, 75686, 75786, 75806, 75816, 75826, 75836, 75846, 75856, 75860, 75861, 75862, 75863, 75864, 75865, 75866, 75867, 75868, 75869, 75876, 75886, 75896, 75986, 76586, 77586, 78586, 79586, 87586, 97586] |
| [123] | [00123, 01023, 01123, 01203, 01213, 01223, 01230, 01231, 01232, 01233, 01234, 01235, 01236, 01237, 01238, 01239, 01243, 01253, 01263, 01273, 01283, 01293, 01323, 01423, 01523, 01623, 01723, 01823, 01923, 02123, 03123, 04123, 05123, 06123, 07123, 08123, 09123, 10023, 10123, 10203, 10213, 10223, 10230, 10231, 10232, 10233, 10234, 10235, 10236, 10237, 10238, 10239, 10243, 10253, 10263, 10273, 10283, 10293, 10323, 10423, 10523, 10623, 10723, 10823, 10923, 11023, 11123, 11203, 11213, 11223, 11230, 11231, 11232, 11233, 11234, 11235, 11236, 11237, 11238, 11239, 11243, 11253, 11263, 11273, 11283, 11293, 11323, 11423, 11523, 11623, 11723, 11823, 11923, 12003, 12013, 12023, 12030, 12031, 12032, 12033, 12034, 12035, 12036, 12037, 12038, 12039, 12043, 12053, 12063, 12073, 12083, 12093, 12103, 12113, 12123, 12130, 12131, 12132, 12133, 12134, 12135, 12136, 12137, 12138, 12139, 12143, 12153, 12163, 12173, 12183, 12193, 12203, 12213, 12223, 12230, 12231, 12232, 12233, 12234, 12235, 12236, 12237, 12238, 12239, 12243, 12253, 12263, 12273, 12283, 12293, 12300, 12301, 12302, 12303, 12304, 12305, 12306, 12307, 12308, 12309, 12310, 12311, 12312, 12313, 12314, 12315, 12316, 12317, 12318, 12319, 12320, 12321, 12322, 12323, 12324, 12325, 12326, 12327, 12328, 12329, 12330, 12331, 12332, 12333, 12334, 12335, 12336, 12337, 12338, 12339, 12340, 12341, 12342, 12343, 12344, 12345, 12346, 12347, 12348, 12349, 12350, 12351, 12352, 12353, 12354, 12355, 12356, 12357, 12358, 12359, 12360, 12361, 12362, 12363, 12364, 12365, 12366, 12367, 12368, 12369, 12370, 12371, 12372, 12373, 12374, 12375, 12376, 12377, 12378, 12379, 12380, 12381, 12382, 12383, 12384, 12385, 12386, 12387, 12388, 12389, 12390, 12391, 12392, 12393, 12394, 12395, 12396, 12397, 12398, 12399, 12403, 12413, 12423, 12430, 12431, 12432, 12433, 12434, 12435, 12436, 12437, 12438, 12439, 12443, 12453, 12463, 12473, 12483, 12493, 12503, 12513, 12523, 12530, 12531, 12532, 12533, 12534, 12535, 12536, 12537, 12538, 12539, 12543, 12553, 12563, 12573, 12583, 12593, 12603, 12613, 12623, 12630, 12631, 12632, 12633, 12634, 12635, 12636, 12637, 12638, 12639, 12643, 12653, 12663, 12673, 12683, 12693, 12703, 12713, 12723, 12730, 12731, 12732, 12733, 12734, 12735, 12736, 12737, 12738, 12739, 12743, 12753, 12763, 12773, 12783, 12793, 12803, 12813, 12823, 12830, 12831, 12832, 12833, 12834, 12835, 12836, 12837, 12838, 12839, 12843, 12853, 12863, 12873, 12883, 12893, 12903, 12913, 12923, 12930, 12931, 12932, 12933, 12934, 12935, 12936, 12937, 12938, 12939, 12943, 12953, 12963, 12973, 12983, 12993, 13023, 13123, 13203, 13213, 13223, 13230, 13231, 13232, 13233, 13234, 13235, 13236, 13237, 13238, 13239, 13243, 13253, 13263, 13273, 13283, 13293, 13323, 13423, 13523, 13623, 13723, 13823, 13923, 14023, 14123, 14203, 14213, 14223, 14230, 14231, 14232, 14233, 14234, 14235, 14236, 14237, 14238, 14239, 14243, 14253, 14263, 14273, 14283, 14293, 14323, 14423, 14523, 14623, 14723, 14823, 14923, 15023, 15123, 15203, 15213, 15223, 15230, 15231, 15232, 15233, 15234, 15235, 15236, 15237, 15238, 15239, 15243, 15253, 15263, 15273, 15283, 15293, 15323, 15423, 15523, 15623, 15723, 15823, 15923, 16023, 16123, 16203, 16213, 16223, 16230, 16231, 16232, 16233, 16234, 16235, 16236, 16237, 16238, 16239, 16243, 16253, 16263, 16273, 16283, 16293, 16323, 16423, 16523, 16623, 16723, 16823, 16923, 17023, 17123, 17203, 17213, 17223, 17230, 17231, 17232, 17233, 17234, 17235, 17236, 17237, 17238, 17239, 17243, 17253, 17263, 17273, 17283, 17293, 17323, 17423, 17523, 17623, 17723, 17823, 17923, 18023, 18123, 18203, 18213, 18223, 18230, 18231, 18232, 18233, 18234, 18235, 18236, 18237, 18238, 18239, 18243, 18253, 18263, 18273, 18283, 18293, 18323, 18423, 18523, 18623, 18723, 18823, 18923, 19023, 19123, 19203, 19213, 19223, 19230, 19231, 19232, 19233, 19234, 19235, 19236, 19237, 19238, 19239, 19243, 19253, 19263, 19273, 19283, 19293, 19323, 19423, 19523, 19623, 19723, 19823, 19923, 20123, 21023, 21123, 21203, 21213, 21223, 21230, 21231, 21232, 21233, 21234, 21235, 21236, 21237, 21238, 21239, 21243, 21253, 21263, 21273, 21283, 21293, 21323, 21423, 21523, 21623, 21723, 21823, 21923, 22123, 23123, 24123, 25123, 26123, 27123, 28123, 29123, 30123, 31023, 31123, 31203, 31213, 31223, 31230, 31231, 31232, 31233, 31234, 31235, 31236, 31237, 31238, 31239, 31243, 31253, 31263, 31273, 31283, 31293, 31323, 31423, 31523, 31623, 31723, 31823, 31923, 32123, 33123, 34123, 35123, 36123, 37123, 38123, 39123, 40123, 41023, 41123, 41203, 41213, 41223, 41230, 41231, 41232, 41233, 41234, 41235, 41236, 41237, 41238, 41239, 41243, 41253, 41263, 41273, 41283, 41293, 41323, 41423, 41523, 41623, 41723, 41823, 41923, 42123, 43123, 44123, 45123, 46123, 47123, 48123, 49123, 50123, 51023, 51123, 51203, 51213, 51223, 51230, 51231, 51232, 51233, 51234, 51235, 51236, 51237, 51238, 51239, 51243, 51253, 51263, 51273, 51283, 51293, 51323, 51423, 51523, 51623, 51723, 51823, 51923, 52123, 53123, 54123, 55123, 56123, 57123, 58123, 59123, 60123, 61023, 61123, 61203, 61213, 61223, 61230, 61231, 61232, 61233, 61234, 61235, 61236, 61237, 61238, 61239, 61243, 61253, 61263, 61273, 61283, 61293, 61323, 61423, 61523, 61623, 61723, 61823, 61923, 62123, 63123, 64123, 65123, 66123, 67123, 68123, 69123, 70123, 71023, 71123, 71203, 71213, 71223, 71230, 71231, 71232, 71233, 71234, 71235, 71236, 71237, 71238, 71239, 71243, 71253, 71263, 71273, 71283, 71293, 71323, 71423, 71523, 71623, 71723, 71823, 71923, 72123, 73123, 74123, 75123, 76123, 77123, 78123, 79123, 80123, 81023, 81123, 81203, 81213, 81223, 81230, 81231, 81232, 81233, 81234, 81235, 81236, 81237, 81238, 81239, 81243, 81253, 81263, 81273, 81283, 81293, 81323, 81423, 81523, 81623, 81723, 81823, 81923, 82123, 83123, 84123, 85123, 86123, 87123, 88123, 89123, 90123, 91023, 91123, 91203, 91213, 91223, 91230, 91231, 91232, 91233, 91234, 91235, 91236, 91237, 91238, 91239, 91243, 91253, 91263, 91273, 91283, 91293, 91323, 91423, 91523, 91623, 91723, 91823, 91923, 92123, 93123, 94123, 95123, 96123, 97123, 98123, 99123] |
|----------------------|--------------------------------------------|




Rules




  • Input is guaranteed non-empty.

  • Leading and trailing zeros matter: 01234 is different from 12340, and 1234 doesn't crack either password. Think of how real passwords work!


  • Standard I/O rules apply.

  • No standard loopholes.

  • This is code-golf, so the shortest answer in bytes wins. Non-codegolfing languages are welcome!







code-golf






share|improve this question









New contributor




cefel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




cefel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited yesterday









Hat

355




355






New contributor




cefel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 days ago









cefelcefel

36128




36128




New contributor




cefel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





cefel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






cefel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 5




    $begingroup$
    Are the digits always in order? Based on the test cases I assume they are, but I couldn't see it mentioned in the rules unless I read past it.
    $endgroup$
    – Kevin Cruijssen
    2 days ago






  • 13




    $begingroup$
    Welcome to PPCG! This is a nice, well-structured, and neatly formatted first challenge. You've clearly done your homework as far as getting that all down. I'm looking forward to answering it (if someone doesn't answer it in R first!). In the future, we suggest using the sandbox to get feedback before posting to main. Hope you enjoy your time on PPCG!
    $endgroup$
    – Giuseppe
    2 days ago








  • 1




    $begingroup$
    @Giuseppe thanks! I've been anonymously reading the questions on this site for years, and I've been writing and tweaking and actually solving this specific problem for a couple months: I liked it enough to skip the sandbox. I'll post there first next time!
    $endgroup$
    – cefel
    2 days ago








  • 2




    $begingroup$
    @Arnauld Well, if your password is 01234 or 12340 you shouldn't be able to log in by typing 1234. Passwords are more a string than a number even if composed by numbers, at least in that sense. So yes, leading and trailing zeros are mandatory.
    $endgroup$
    – cefel
    2 days ago








  • 2




    $begingroup$
    The final test case appears to be missing 22123... unless I'm misunderstanding something?
    $endgroup$
    – Jonah
    2 days ago














  • 5




    $begingroup$
    Are the digits always in order? Based on the test cases I assume they are, but I couldn't see it mentioned in the rules unless I read past it.
    $endgroup$
    – Kevin Cruijssen
    2 days ago






  • 13




    $begingroup$
    Welcome to PPCG! This is a nice, well-structured, and neatly formatted first challenge. You've clearly done your homework as far as getting that all down. I'm looking forward to answering it (if someone doesn't answer it in R first!). In the future, we suggest using the sandbox to get feedback before posting to main. Hope you enjoy your time on PPCG!
    $endgroup$
    – Giuseppe
    2 days ago








  • 1




    $begingroup$
    @Giuseppe thanks! I've been anonymously reading the questions on this site for years, and I've been writing and tweaking and actually solving this specific problem for a couple months: I liked it enough to skip the sandbox. I'll post there first next time!
    $endgroup$
    – cefel
    2 days ago








  • 2




    $begingroup$
    @Arnauld Well, if your password is 01234 or 12340 you shouldn't be able to log in by typing 1234. Passwords are more a string than a number even if composed by numbers, at least in that sense. So yes, leading and trailing zeros are mandatory.
    $endgroup$
    – cefel
    2 days ago








  • 2




    $begingroup$
    The final test case appears to be missing 22123... unless I'm misunderstanding something?
    $endgroup$
    – Jonah
    2 days ago








5




5




$begingroup$
Are the digits always in order? Based on the test cases I assume they are, but I couldn't see it mentioned in the rules unless I read past it.
$endgroup$
– Kevin Cruijssen
2 days ago




$begingroup$
Are the digits always in order? Based on the test cases I assume they are, but I couldn't see it mentioned in the rules unless I read past it.
$endgroup$
– Kevin Cruijssen
2 days ago




13




13




$begingroup$
Welcome to PPCG! This is a nice, well-structured, and neatly formatted first challenge. You've clearly done your homework as far as getting that all down. I'm looking forward to answering it (if someone doesn't answer it in R first!). In the future, we suggest using the sandbox to get feedback before posting to main. Hope you enjoy your time on PPCG!
$endgroup$
– Giuseppe
2 days ago






$begingroup$
Welcome to PPCG! This is a nice, well-structured, and neatly formatted first challenge. You've clearly done your homework as far as getting that all down. I'm looking forward to answering it (if someone doesn't answer it in R first!). In the future, we suggest using the sandbox to get feedback before posting to main. Hope you enjoy your time on PPCG!
$endgroup$
– Giuseppe
2 days ago






1




1




$begingroup$
@Giuseppe thanks! I've been anonymously reading the questions on this site for years, and I've been writing and tweaking and actually solving this specific problem for a couple months: I liked it enough to skip the sandbox. I'll post there first next time!
$endgroup$
– cefel
2 days ago






$begingroup$
@Giuseppe thanks! I've been anonymously reading the questions on this site for years, and I've been writing and tweaking and actually solving this specific problem for a couple months: I liked it enough to skip the sandbox. I'll post there first next time!
$endgroup$
– cefel
2 days ago






2




2




$begingroup$
@Arnauld Well, if your password is 01234 or 12340 you shouldn't be able to log in by typing 1234. Passwords are more a string than a number even if composed by numbers, at least in that sense. So yes, leading and trailing zeros are mandatory.
$endgroup$
– cefel
2 days ago






$begingroup$
@Arnauld Well, if your password is 01234 or 12340 you shouldn't be able to log in by typing 1234. Passwords are more a string than a number even if composed by numbers, at least in that sense. So yes, leading and trailing zeros are mandatory.
$endgroup$
– cefel
2 days ago






2




2




$begingroup$
The final test case appears to be missing 22123... unless I'm misunderstanding something?
$endgroup$
– Jonah
2 days ago




$begingroup$
The final test case appears to be missing 22123... unless I'm misunderstanding something?
$endgroup$
– Jonah
2 days ago










17 Answers
17






active

oldest

votes


















24












$begingroup$

Python, 101 bytes





lambda e:['%05d'%i for i in range(10**5)if all(re.search('.*'.join(x),'%05d'%i)for x in e)]
import re


Try it online! Works in Python 2 as well as Python 3.



(97 bytes in Python 3.8:)



lambda e:[p for i in range(10**5)if all(re.search('.*'.join(x),p:='%05d'%i)for x in e)]
import re





share|improve this answer











$endgroup$









  • 1




    $begingroup$
    This is a lovely solution...
    $endgroup$
    – Jonah
    2 days ago



















21












$begingroup$


05AB1E, 11 9 bytes



žh5ãʒæIåP


Try it online!



Explanation



žh          # push 0123456789
5ã # 5 times cartesian product
ʒ # filter, keep only values are true under:
æ # powerset of value
Iå # check if each of the input values are in this list
P # product





share|improve this answer











$endgroup$





















    11












    $begingroup$

    JavaScript (ES6), 88 bytes



    Prints the results with alert().





    a=>{for(k=n=1e5;n--;)a.every(x=>(s=([k]+n).slice(-5)).match([...x].join`.*`))&&alert(s)}


    Try it online!



    Commented



    a => {                    // a[] = input array of 3-character strings
    for(k = n = 1e5; n--;) // initialize k to 100000; for n = 99999 to 0:
    a.every(x => // for each string x = 'XYZ' in a[]:
    ( s = // define s as the concatenation of
    ([k] + n) // '100000' and n; e.g. '100000' + 1337 -> '1000001337'
    .slice(-5) // keep the last 5 digits; e.g. '01337'
    ).match( // test whether this string is matching
    [...x].join`.*` // the pattern /X.*Y.*Z/
    ) //
    ) && // end of every(); if all tests were successful:
    alert(s) // output s
    } //





    share|improve this answer











    $endgroup$





















      8












      $begingroup$

      Haskell, 81 80 78 76 bytes



      f x=[p|p<-mapM(:['1'..'9'])"00000",all(`elem`(concat.words<$>mapM(:" ")p))x]


      The obvious brute force approach in Haskell: built a list of all possible passwords and keep those where all elements from the input list are in respective list of subsequences.



      Try it online!



      Edit: -1 byte thanks to @xnor, -2 -4 bytes thanks to @H.PWiz






      share|improve this answer











      $endgroup$









      • 1




        $begingroup$
        Looks like you can compute the subseqs yourself a little shorter.
        $endgroup$
        – xnor
        yesterday






      • 1




        $begingroup$
        concat.words<$>mapM(:" ")p is shorter
        $endgroup$
        – H.PWiz
        yesterday






      • 2




        $begingroup$
        use p<-mapM(:['1'..'9'])"00000" to save 2 more bytes
        $endgroup$
        – H.PWiz
        12 hours ago



















      5












      $begingroup$


      Jelly, 11 bytes



      9Żṗ5ŒPiⱮẠɗƇ


      Try it online!






      share|improve this answer









      $endgroup$





















        5












        $begingroup$

        Pyth, 11 bytes



        f<QyT^s`MT5


        Takes input as a set of strings.
        Try it here



        Explanation



        f<QyT^s`MT5
        s`MT Take the digits as a string.
        ^ 5 Take the Cartesian product with itself 5 times.
        f T Filter the ones...
        <Qy ... where the input is a subset of the power set.





        share|improve this answer









        $endgroup$





















          5












          $begingroup$


          Ruby, 54 bytes





          ->a{(?0*5..?9*5).select{|x|a.all?{|y|x=~/#{y*'.*'}/}}}


          Try it online!



          Takes input as an arrray of character arrays.






          share|improve this answer









          $endgroup$













          • $begingroup$
            Well done! You beat me by 25 bytes. Should I delete my answer?
            $endgroup$
            – Eric Duminil
            2 days ago






          • 1




            $begingroup$
            No, as long as you have a valid answer, there's no need to delete it.
            $endgroup$
            – Kirill L.
            2 days ago



















          5












          $begingroup$


          Python 3, 98 bytes





          f=lambda l,s='':any(l)or print(s)if s[4:]else[f([x[x[:1]==c:]for x in l],s+c)for c in'0123456789']


          Try it online!



          Recursively tries building every five-digit number string in s, tracking the subsequences in l still remaining to be hit. If all are empty by the end, prints the result.




          Python 3.8 (pre-release), 94 bytes





          lambda l:[s for n in range(10**5)if all(''in[x:=x[x[:1]==c:]for c in(s:='%05d'%n)]for x in l)]


          Try it online!



          Behold the power of assignment expressions!. Uses the method from here for checking subsequences.






          share|improve this answer











          $endgroup$





















            4












            $begingroup$


            Perl 5 -a, 80 bytes





            map{s||($t=0)x(5-y///c)|e;for$b(map s//.*/gr,@F){/$b/&&$t++}$t==@F&&say}0..99999


            Try it online!






            share|improve this answer









            $endgroup$









            • 1




              $begingroup$
              $t+=/$b/ instead of /$b/&&$t++
              $endgroup$
              – Nahuel Fouilleul
              2 days ago



















            4












            $begingroup$


            Retina, 53 bytes



            ~(`
            .$*
            m`^
            G`
            ^
            K`¶5+%`$$¶0"1"2"3"4"5"6"7"8"9¶
            "
            $$
            "


            Try it online! Explanation:



            ~(`


            After executing the script, take the result as a new script, and execute that, too.



            .$*


            Insert .* everywhere. This results in .*3.*2.*0.* although we only need 3.*2.*0, not that it matters.



            m`^
            G`


            Insert a G` at the start of each line. This turns it into a Retina Grep command.



            ^
            K`¶5+%`$$¶0"1"2"3"4"5"6"7"8"9¶
            "
            $$
            "


            Prefix two more Retina commands. The resulting script will therefore look something like this:



            K`


            Clear the buffer (which contains the original input).



            5+


            Repeat 5 times...



            %`$


            ... append to each line...



            0$"1$"2$"3$"4$"5$"6$"7$"8$"9


            ... the digit 0, then a copy of the line, then the digit 1, etc. until 9. This means that after n loops you will have all n-digit numbers.



            G`.*3.*2.*0.*
            G`.*7.*2.*3.*
            G`.*7.*3.*0.*


            Filter out the possible numbers based on the input.






            share|improve this answer









            $endgroup$





















              4












              $begingroup$


              R, 80 82 bytes





              Reduce(intersect,lapply(gsub("",".*",scan(,"")),grep,sprintf("%05d",0:99999),v=T))


              Here’s a base R solution using regex. Writing this nested series of functions made me realise how much I’ve learned to appreciate the magrittr package!



              Initially hadn’t read rules on input, so now reads from stdin (thanks @KirillL).



              Try it online!






              share|improve this answer











              $endgroup$













              • $begingroup$
                @digEmAll it says it’s 82 bytes doesn’t it? You can’t use integers because of potential for leading zeroes in the input.
                $endgroup$
                – Nick Kennedy
                yesterday










              • $begingroup$
                Sorry, I read the title and unconsciously I picked the minimum number without noticing that it was strikedthrough... and yes, sorry again you're right about the string input ;)
                $endgroup$
                – digEmAll
                yesterday





















              2












              $begingroup$


              Ruby, 79 77 bytes





              ->x{(0...1e5).map{|i|'%05d'%i}.select{|i|x.all?{|c|i=~/#{c.gsub('','.*')}/}}}


              Try it online!



              Input is an array of strings.



              Here's a more readable version of the same code:



              def f(codes)
              (0...10**5).map{|i| '%05d'%i}.select do |i|
              codes.all? do |code|
              i =~ Regexp.new(code.chars.join('.*'))
              end
              end
              end





              share|improve this answer











              $endgroup$













              • $begingroup$
                BTW, your approach can also be made shorter by switching to char array input, as in my version, and -2 more bytes by formatting the upper value as 1e5, like this
                $endgroup$
                – Kirill L.
                2 days ago












              • $begingroup$
                @KirillL. Thanks for the -2 bytes. I won't change the input format because my answer would look too much like yours. Cheers!
                $endgroup$
                – Eric Duminil
                2 days ago



















              2












              $begingroup$


              J, 52 bytes



              (>,{;^:4~i.10)([#~]*/@e."2((#~3=+/"1)#:i.32)#"_ 1[)]


              Try it online!






              share|improve this answer











              $endgroup$





















                1












                $begingroup$

                PHP 128 bytes





                for(;$i++<1e5;$k>$argc||print$s)for($k=0;$n=$argv[++$k];)preg_match("/$n[0].*$n[1].*$n[2]/",$s=sprintf("%05d
                ",$i-1))||$k=$argc;


                or



                for(;$i<1e5;$i+=$k<$argc||print$s)for($k=0;$n=$argv[++$k];)if(!preg_match("/$n[0].*$n[1].*$n[2]/",$s=sprintf("%05d
                ",$i)))break;


                take input from command line arguments. Run with -nr or try them online.






                share|improve this answer









                $endgroup$





















                  1












                  $begingroup$


                  C# (Visual C# Interactive Compiler), 111 bytes





                  x=>{for(int i=0;i<1e5;){var s=$"{i++:D5}";if(x.All(t=>t.Aggregate(0,(a,c)=>a<0?a:s.IndexOf(c,a))>0))Print(s);}}


                  Try it online!



                  // x: input list of strings
                  x=>{
                  // generate all numbers under 100k
                  for(int i=0;i<1e5;){
                  // convert the current number to
                  // a 5 digit string padded with 0's
                  var s=$"{i++:D5}";
                  // test all inputs against the 5 digit
                  // string using an aggregate.
                  // each step of the aggregate gets
                  // the index of the next occurrence
                  // of the current character starting
                  // at the previously found character.
                  // a negative index indicates error.
                  if(x.All(t=>t
                  .Aggregate(0,(a,c)=>
                  a<0
                  ?a
                  :s.IndexOf(c,a))>0))
                  // output to STDOUT
                  Print(s);
                  }
                  }





                  share|improve this answer











                  $endgroup$





















                    1












                    $begingroup$

                    Japt, 23 bytes



                    1e5o ù'0 fA{Ue@AèXË+".*


                    Try it!



                    1e5o ù'0 fA{Ue@AèXË+".*    # full program

                    1e5o # generate numbers under 100k
                    ù'0 # left pad with 0's
                    fA{ # filter array
                    Ue@ # check every element of input array
                    Aè # A is the number to be tested.
                    # test it against a regex.
                    Ë+".* # the regex is an element from the input array
                    # with wildcards injected between each character





                    share|improve this answer











                    $endgroup$













                    • $begingroup$
                      less useless variables: 1e5o ù'0 fA{Ue@AèX®+".* :P
                      $endgroup$
                      – ASCII-only
                      7 hours ago










                    • $begingroup$
                      also 23: 1e5o ù'0 fA{Ue@AèX¬q".*
                      $endgroup$
                      – ASCII-only
                      6 hours ago










                    • $begingroup$
                      21 bytes
                      $endgroup$
                      – Shaggy
                      1 hour ago



















                    0












                    $begingroup$


                    Clean, 113 bytes



                    import StdEnv,Data.List
                    $l=[s\s<-iter 5(p=[[c:e]\e<-p,c<-['0'..'9']])[[]]|all(flip any(subsequences s)o(==))l]


                    Try it online!






                    share|improve this answer









                    $endgroup$













                      Your Answer





                      StackExchange.ifUsing("editor", function () {
                      return StackExchange.using("mathjaxEditing", function () {
                      StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
                      StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
                      });
                      });
                      }, "mathjax-editing");

                      StackExchange.ifUsing("editor", function () {
                      StackExchange.using("externalEditor", function () {
                      StackExchange.using("snippets", function () {
                      StackExchange.snippets.init();
                      });
                      });
                      }, "code-snippets");

                      StackExchange.ready(function() {
                      var channelOptions = {
                      tags: "".split(" "),
                      id: "200"
                      };
                      initTagRenderer("".split(" "), "".split(" "), channelOptions);

                      StackExchange.using("externalEditor", function() {
                      // Have to fire editor after snippets, if snippets enabled
                      if (StackExchange.settings.snippets.snippetsEnabled) {
                      StackExchange.using("snippets", function() {
                      createEditor();
                      });
                      }
                      else {
                      createEditor();
                      }
                      });

                      function createEditor() {
                      StackExchange.prepareEditor({
                      heartbeatType: 'answer',
                      autoActivateHeartbeat: false,
                      convertImagesToLinks: false,
                      noModals: true,
                      showLowRepImageUploadWarning: true,
                      reputationToPostImages: null,
                      bindNavPrevention: true,
                      postfix: "",
                      imageUploader: {
                      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                      allowUrls: true
                      },
                      onDemand: true,
                      discardSelector: ".discard-answer"
                      ,immediatelyShowMarkdownHelp:true
                      });


                      }
                      });






                      cefel is a new contributor. Be nice, and check out our Code of Conduct.










                      draft saved

                      draft discarded


















                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f180243%2fcrack-the-bank-accounts-password%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown

























                      17 Answers
                      17






                      active

                      oldest

                      votes








                      17 Answers
                      17






                      active

                      oldest

                      votes









                      active

                      oldest

                      votes






                      active

                      oldest

                      votes









                      24












                      $begingroup$

                      Python, 101 bytes





                      lambda e:['%05d'%i for i in range(10**5)if all(re.search('.*'.join(x),'%05d'%i)for x in e)]
                      import re


                      Try it online! Works in Python 2 as well as Python 3.



                      (97 bytes in Python 3.8:)



                      lambda e:[p for i in range(10**5)if all(re.search('.*'.join(x),p:='%05d'%i)for x in e)]
                      import re





                      share|improve this answer











                      $endgroup$









                      • 1




                        $begingroup$
                        This is a lovely solution...
                        $endgroup$
                        – Jonah
                        2 days ago
















                      24












                      $begingroup$

                      Python, 101 bytes





                      lambda e:['%05d'%i for i in range(10**5)if all(re.search('.*'.join(x),'%05d'%i)for x in e)]
                      import re


                      Try it online! Works in Python 2 as well as Python 3.



                      (97 bytes in Python 3.8:)



                      lambda e:[p for i in range(10**5)if all(re.search('.*'.join(x),p:='%05d'%i)for x in e)]
                      import re





                      share|improve this answer











                      $endgroup$









                      • 1




                        $begingroup$
                        This is a lovely solution...
                        $endgroup$
                        – Jonah
                        2 days ago














                      24












                      24








                      24





                      $begingroup$

                      Python, 101 bytes





                      lambda e:['%05d'%i for i in range(10**5)if all(re.search('.*'.join(x),'%05d'%i)for x in e)]
                      import re


                      Try it online! Works in Python 2 as well as Python 3.



                      (97 bytes in Python 3.8:)



                      lambda e:[p for i in range(10**5)if all(re.search('.*'.join(x),p:='%05d'%i)for x in e)]
                      import re





                      share|improve this answer











                      $endgroup$



                      Python, 101 bytes





                      lambda e:['%05d'%i for i in range(10**5)if all(re.search('.*'.join(x),'%05d'%i)for x in e)]
                      import re


                      Try it online! Works in Python 2 as well as Python 3.



                      (97 bytes in Python 3.8:)



                      lambda e:[p for i in range(10**5)if all(re.search('.*'.join(x),p:='%05d'%i)for x in e)]
                      import re






                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited 7 hours ago

























                      answered 2 days ago









                      LynnLynn

                      49.5k795228




                      49.5k795228








                      • 1




                        $begingroup$
                        This is a lovely solution...
                        $endgroup$
                        – Jonah
                        2 days ago














                      • 1




                        $begingroup$
                        This is a lovely solution...
                        $endgroup$
                        – Jonah
                        2 days ago








                      1




                      1




                      $begingroup$
                      This is a lovely solution...
                      $endgroup$
                      – Jonah
                      2 days ago




                      $begingroup$
                      This is a lovely solution...
                      $endgroup$
                      – Jonah
                      2 days ago











                      21












                      $begingroup$


                      05AB1E, 11 9 bytes



                      žh5ãʒæIåP


                      Try it online!



                      Explanation



                      žh          # push 0123456789
                      5ã # 5 times cartesian product
                      ʒ # filter, keep only values are true under:
                      æ # powerset of value
                      Iå # check if each of the input values are in this list
                      P # product





                      share|improve this answer











                      $endgroup$


















                        21












                        $begingroup$


                        05AB1E, 11 9 bytes



                        žh5ãʒæIåP


                        Try it online!



                        Explanation



                        žh          # push 0123456789
                        5ã # 5 times cartesian product
                        ʒ # filter, keep only values are true under:
                        æ # powerset of value
                        Iå # check if each of the input values are in this list
                        P # product





                        share|improve this answer











                        $endgroup$
















                          21












                          21








                          21





                          $begingroup$


                          05AB1E, 11 9 bytes



                          žh5ãʒæIåP


                          Try it online!



                          Explanation



                          žh          # push 0123456789
                          5ã # 5 times cartesian product
                          ʒ # filter, keep only values are true under:
                          æ # powerset of value
                          Iå # check if each of the input values are in this list
                          P # product





                          share|improve this answer











                          $endgroup$




                          05AB1E, 11 9 bytes



                          žh5ãʒæIåP


                          Try it online!



                          Explanation



                          žh          # push 0123456789
                          5ã # 5 times cartesian product
                          ʒ # filter, keep only values are true under:
                          æ # powerset of value
                          Iå # check if each of the input values are in this list
                          P # product






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited 2 days ago

























                          answered 2 days ago









                          EmignaEmigna

                          46.6k432142




                          46.6k432142























                              11












                              $begingroup$

                              JavaScript (ES6), 88 bytes



                              Prints the results with alert().





                              a=>{for(k=n=1e5;n--;)a.every(x=>(s=([k]+n).slice(-5)).match([...x].join`.*`))&&alert(s)}


                              Try it online!



                              Commented



                              a => {                    // a[] = input array of 3-character strings
                              for(k = n = 1e5; n--;) // initialize k to 100000; for n = 99999 to 0:
                              a.every(x => // for each string x = 'XYZ' in a[]:
                              ( s = // define s as the concatenation of
                              ([k] + n) // '100000' and n; e.g. '100000' + 1337 -> '1000001337'
                              .slice(-5) // keep the last 5 digits; e.g. '01337'
                              ).match( // test whether this string is matching
                              [...x].join`.*` // the pattern /X.*Y.*Z/
                              ) //
                              ) && // end of every(); if all tests were successful:
                              alert(s) // output s
                              } //





                              share|improve this answer











                              $endgroup$


















                                11












                                $begingroup$

                                JavaScript (ES6), 88 bytes



                                Prints the results with alert().





                                a=>{for(k=n=1e5;n--;)a.every(x=>(s=([k]+n).slice(-5)).match([...x].join`.*`))&&alert(s)}


                                Try it online!



                                Commented



                                a => {                    // a[] = input array of 3-character strings
                                for(k = n = 1e5; n--;) // initialize k to 100000; for n = 99999 to 0:
                                a.every(x => // for each string x = 'XYZ' in a[]:
                                ( s = // define s as the concatenation of
                                ([k] + n) // '100000' and n; e.g. '100000' + 1337 -> '1000001337'
                                .slice(-5) // keep the last 5 digits; e.g. '01337'
                                ).match( // test whether this string is matching
                                [...x].join`.*` // the pattern /X.*Y.*Z/
                                ) //
                                ) && // end of every(); if all tests were successful:
                                alert(s) // output s
                                } //





                                share|improve this answer











                                $endgroup$
















                                  11












                                  11








                                  11





                                  $begingroup$

                                  JavaScript (ES6), 88 bytes



                                  Prints the results with alert().





                                  a=>{for(k=n=1e5;n--;)a.every(x=>(s=([k]+n).slice(-5)).match([...x].join`.*`))&&alert(s)}


                                  Try it online!



                                  Commented



                                  a => {                    // a[] = input array of 3-character strings
                                  for(k = n = 1e5; n--;) // initialize k to 100000; for n = 99999 to 0:
                                  a.every(x => // for each string x = 'XYZ' in a[]:
                                  ( s = // define s as the concatenation of
                                  ([k] + n) // '100000' and n; e.g. '100000' + 1337 -> '1000001337'
                                  .slice(-5) // keep the last 5 digits; e.g. '01337'
                                  ).match( // test whether this string is matching
                                  [...x].join`.*` // the pattern /X.*Y.*Z/
                                  ) //
                                  ) && // end of every(); if all tests were successful:
                                  alert(s) // output s
                                  } //





                                  share|improve this answer











                                  $endgroup$



                                  JavaScript (ES6), 88 bytes



                                  Prints the results with alert().





                                  a=>{for(k=n=1e5;n--;)a.every(x=>(s=([k]+n).slice(-5)).match([...x].join`.*`))&&alert(s)}


                                  Try it online!



                                  Commented



                                  a => {                    // a[] = input array of 3-character strings
                                  for(k = n = 1e5; n--;) // initialize k to 100000; for n = 99999 to 0:
                                  a.every(x => // for each string x = 'XYZ' in a[]:
                                  ( s = // define s as the concatenation of
                                  ([k] + n) // '100000' and n; e.g. '100000' + 1337 -> '1000001337'
                                  .slice(-5) // keep the last 5 digits; e.g. '01337'
                                  ).match( // test whether this string is matching
                                  [...x].join`.*` // the pattern /X.*Y.*Z/
                                  ) //
                                  ) && // end of every(); if all tests were successful:
                                  alert(s) // output s
                                  } //






                                  share|improve this answer














                                  share|improve this answer



                                  share|improve this answer








                                  edited 2 days ago

























                                  answered 2 days ago









                                  ArnauldArnauld

                                  76.7k693322




                                  76.7k693322























                                      8












                                      $begingroup$

                                      Haskell, 81 80 78 76 bytes



                                      f x=[p|p<-mapM(:['1'..'9'])"00000",all(`elem`(concat.words<$>mapM(:" ")p))x]


                                      The obvious brute force approach in Haskell: built a list of all possible passwords and keep those where all elements from the input list are in respective list of subsequences.



                                      Try it online!



                                      Edit: -1 byte thanks to @xnor, -2 -4 bytes thanks to @H.PWiz






                                      share|improve this answer











                                      $endgroup$









                                      • 1




                                        $begingroup$
                                        Looks like you can compute the subseqs yourself a little shorter.
                                        $endgroup$
                                        – xnor
                                        yesterday






                                      • 1




                                        $begingroup$
                                        concat.words<$>mapM(:" ")p is shorter
                                        $endgroup$
                                        – H.PWiz
                                        yesterday






                                      • 2




                                        $begingroup$
                                        use p<-mapM(:['1'..'9'])"00000" to save 2 more bytes
                                        $endgroup$
                                        – H.PWiz
                                        12 hours ago
















                                      8












                                      $begingroup$

                                      Haskell, 81 80 78 76 bytes



                                      f x=[p|p<-mapM(:['1'..'9'])"00000",all(`elem`(concat.words<$>mapM(:" ")p))x]


                                      The obvious brute force approach in Haskell: built a list of all possible passwords and keep those where all elements from the input list are in respective list of subsequences.



                                      Try it online!



                                      Edit: -1 byte thanks to @xnor, -2 -4 bytes thanks to @H.PWiz






                                      share|improve this answer











                                      $endgroup$









                                      • 1




                                        $begingroup$
                                        Looks like you can compute the subseqs yourself a little shorter.
                                        $endgroup$
                                        – xnor
                                        yesterday






                                      • 1




                                        $begingroup$
                                        concat.words<$>mapM(:" ")p is shorter
                                        $endgroup$
                                        – H.PWiz
                                        yesterday






                                      • 2




                                        $begingroup$
                                        use p<-mapM(:['1'..'9'])"00000" to save 2 more bytes
                                        $endgroup$
                                        – H.PWiz
                                        12 hours ago














                                      8












                                      8








                                      8





                                      $begingroup$

                                      Haskell, 81 80 78 76 bytes



                                      f x=[p|p<-mapM(:['1'..'9'])"00000",all(`elem`(concat.words<$>mapM(:" ")p))x]


                                      The obvious brute force approach in Haskell: built a list of all possible passwords and keep those where all elements from the input list are in respective list of subsequences.



                                      Try it online!



                                      Edit: -1 byte thanks to @xnor, -2 -4 bytes thanks to @H.PWiz






                                      share|improve this answer











                                      $endgroup$



                                      Haskell, 81 80 78 76 bytes



                                      f x=[p|p<-mapM(:['1'..'9'])"00000",all(`elem`(concat.words<$>mapM(:" ")p))x]


                                      The obvious brute force approach in Haskell: built a list of all possible passwords and keep those where all elements from the input list are in respective list of subsequences.



                                      Try it online!



                                      Edit: -1 byte thanks to @xnor, -2 -4 bytes thanks to @H.PWiz







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited 11 hours ago

























                                      answered yesterday









                                      niminimi

                                      31.9k32285




                                      31.9k32285








                                      • 1




                                        $begingroup$
                                        Looks like you can compute the subseqs yourself a little shorter.
                                        $endgroup$
                                        – xnor
                                        yesterday






                                      • 1




                                        $begingroup$
                                        concat.words<$>mapM(:" ")p is shorter
                                        $endgroup$
                                        – H.PWiz
                                        yesterday






                                      • 2




                                        $begingroup$
                                        use p<-mapM(:['1'..'9'])"00000" to save 2 more bytes
                                        $endgroup$
                                        – H.PWiz
                                        12 hours ago














                                      • 1




                                        $begingroup$
                                        Looks like you can compute the subseqs yourself a little shorter.
                                        $endgroup$
                                        – xnor
                                        yesterday






                                      • 1




                                        $begingroup$
                                        concat.words<$>mapM(:" ")p is shorter
                                        $endgroup$
                                        – H.PWiz
                                        yesterday






                                      • 2




                                        $begingroup$
                                        use p<-mapM(:['1'..'9'])"00000" to save 2 more bytes
                                        $endgroup$
                                        – H.PWiz
                                        12 hours ago








                                      1




                                      1




                                      $begingroup$
                                      Looks like you can compute the subseqs yourself a little shorter.
                                      $endgroup$
                                      – xnor
                                      yesterday




                                      $begingroup$
                                      Looks like you can compute the subseqs yourself a little shorter.
                                      $endgroup$
                                      – xnor
                                      yesterday




                                      1




                                      1




                                      $begingroup$
                                      concat.words<$>mapM(:" ")p is shorter
                                      $endgroup$
                                      – H.PWiz
                                      yesterday




                                      $begingroup$
                                      concat.words<$>mapM(:" ")p is shorter
                                      $endgroup$
                                      – H.PWiz
                                      yesterday




                                      2




                                      2




                                      $begingroup$
                                      use p<-mapM(:['1'..'9'])"00000" to save 2 more bytes
                                      $endgroup$
                                      – H.PWiz
                                      12 hours ago




                                      $begingroup$
                                      use p<-mapM(:['1'..'9'])"00000" to save 2 more bytes
                                      $endgroup$
                                      – H.PWiz
                                      12 hours ago











                                      5












                                      $begingroup$


                                      Jelly, 11 bytes



                                      9Żṗ5ŒPiⱮẠɗƇ


                                      Try it online!






                                      share|improve this answer









                                      $endgroup$


















                                        5












                                        $begingroup$


                                        Jelly, 11 bytes



                                        9Żṗ5ŒPiⱮẠɗƇ


                                        Try it online!






                                        share|improve this answer









                                        $endgroup$
















                                          5












                                          5








                                          5





                                          $begingroup$


                                          Jelly, 11 bytes



                                          9Żṗ5ŒPiⱮẠɗƇ


                                          Try it online!






                                          share|improve this answer









                                          $endgroup$




                                          Jelly, 11 bytes



                                          9Żṗ5ŒPiⱮẠɗƇ


                                          Try it online!







                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered 2 days ago









                                          Erik the OutgolferErik the Outgolfer

                                          32k429103




                                          32k429103























                                              5












                                              $begingroup$

                                              Pyth, 11 bytes



                                              f<QyT^s`MT5


                                              Takes input as a set of strings.
                                              Try it here



                                              Explanation



                                              f<QyT^s`MT5
                                              s`MT Take the digits as a string.
                                              ^ 5 Take the Cartesian product with itself 5 times.
                                              f T Filter the ones...
                                              <Qy ... where the input is a subset of the power set.





                                              share|improve this answer









                                              $endgroup$


















                                                5












                                                $begingroup$

                                                Pyth, 11 bytes



                                                f<QyT^s`MT5


                                                Takes input as a set of strings.
                                                Try it here



                                                Explanation



                                                f<QyT^s`MT5
                                                s`MT Take the digits as a string.
                                                ^ 5 Take the Cartesian product with itself 5 times.
                                                f T Filter the ones...
                                                <Qy ... where the input is a subset of the power set.





                                                share|improve this answer









                                                $endgroup$
















                                                  5












                                                  5








                                                  5





                                                  $begingroup$

                                                  Pyth, 11 bytes



                                                  f<QyT^s`MT5


                                                  Takes input as a set of strings.
                                                  Try it here



                                                  Explanation



                                                  f<QyT^s`MT5
                                                  s`MT Take the digits as a string.
                                                  ^ 5 Take the Cartesian product with itself 5 times.
                                                  f T Filter the ones...
                                                  <Qy ... where the input is a subset of the power set.





                                                  share|improve this answer









                                                  $endgroup$



                                                  Pyth, 11 bytes



                                                  f<QyT^s`MT5


                                                  Takes input as a set of strings.
                                                  Try it here



                                                  Explanation



                                                  f<QyT^s`MT5
                                                  s`MT Take the digits as a string.
                                                  ^ 5 Take the Cartesian product with itself 5 times.
                                                  f T Filter the ones...
                                                  <Qy ... where the input is a subset of the power set.






                                                  share|improve this answer












                                                  share|improve this answer



                                                  share|improve this answer










                                                  answered 2 days ago









                                                  MnemonicMnemonic

                                                  4,7851730




                                                  4,7851730























                                                      5












                                                      $begingroup$


                                                      Ruby, 54 bytes





                                                      ->a{(?0*5..?9*5).select{|x|a.all?{|y|x=~/#{y*'.*'}/}}}


                                                      Try it online!



                                                      Takes input as an arrray of character arrays.






                                                      share|improve this answer









                                                      $endgroup$













                                                      • $begingroup$
                                                        Well done! You beat me by 25 bytes. Should I delete my answer?
                                                        $endgroup$
                                                        – Eric Duminil
                                                        2 days ago






                                                      • 1




                                                        $begingroup$
                                                        No, as long as you have a valid answer, there's no need to delete it.
                                                        $endgroup$
                                                        – Kirill L.
                                                        2 days ago
















                                                      5












                                                      $begingroup$


                                                      Ruby, 54 bytes





                                                      ->a{(?0*5..?9*5).select{|x|a.all?{|y|x=~/#{y*'.*'}/}}}


                                                      Try it online!



                                                      Takes input as an arrray of character arrays.






                                                      share|improve this answer









                                                      $endgroup$













                                                      • $begingroup$
                                                        Well done! You beat me by 25 bytes. Should I delete my answer?
                                                        $endgroup$
                                                        – Eric Duminil
                                                        2 days ago






                                                      • 1




                                                        $begingroup$
                                                        No, as long as you have a valid answer, there's no need to delete it.
                                                        $endgroup$
                                                        – Kirill L.
                                                        2 days ago














                                                      5












                                                      5








                                                      5





                                                      $begingroup$


                                                      Ruby, 54 bytes





                                                      ->a{(?0*5..?9*5).select{|x|a.all?{|y|x=~/#{y*'.*'}/}}}


                                                      Try it online!



                                                      Takes input as an arrray of character arrays.






                                                      share|improve this answer









                                                      $endgroup$




                                                      Ruby, 54 bytes





                                                      ->a{(?0*5..?9*5).select{|x|a.all?{|y|x=~/#{y*'.*'}/}}}


                                                      Try it online!



                                                      Takes input as an arrray of character arrays.







                                                      share|improve this answer












                                                      share|improve this answer



                                                      share|improve this answer










                                                      answered 2 days ago









                                                      Kirill L.Kirill L.

                                                      4,5851523




                                                      4,5851523












                                                      • $begingroup$
                                                        Well done! You beat me by 25 bytes. Should I delete my answer?
                                                        $endgroup$
                                                        – Eric Duminil
                                                        2 days ago






                                                      • 1




                                                        $begingroup$
                                                        No, as long as you have a valid answer, there's no need to delete it.
                                                        $endgroup$
                                                        – Kirill L.
                                                        2 days ago


















                                                      • $begingroup$
                                                        Well done! You beat me by 25 bytes. Should I delete my answer?
                                                        $endgroup$
                                                        – Eric Duminil
                                                        2 days ago






                                                      • 1




                                                        $begingroup$
                                                        No, as long as you have a valid answer, there's no need to delete it.
                                                        $endgroup$
                                                        – Kirill L.
                                                        2 days ago
















                                                      $begingroup$
                                                      Well done! You beat me by 25 bytes. Should I delete my answer?
                                                      $endgroup$
                                                      – Eric Duminil
                                                      2 days ago




                                                      $begingroup$
                                                      Well done! You beat me by 25 bytes. Should I delete my answer?
                                                      $endgroup$
                                                      – Eric Duminil
                                                      2 days ago




                                                      1




                                                      1




                                                      $begingroup$
                                                      No, as long as you have a valid answer, there's no need to delete it.
                                                      $endgroup$
                                                      – Kirill L.
                                                      2 days ago




                                                      $begingroup$
                                                      No, as long as you have a valid answer, there's no need to delete it.
                                                      $endgroup$
                                                      – Kirill L.
                                                      2 days ago











                                                      5












                                                      $begingroup$


                                                      Python 3, 98 bytes





                                                      f=lambda l,s='':any(l)or print(s)if s[4:]else[f([x[x[:1]==c:]for x in l],s+c)for c in'0123456789']


                                                      Try it online!



                                                      Recursively tries building every five-digit number string in s, tracking the subsequences in l still remaining to be hit. If all are empty by the end, prints the result.




                                                      Python 3.8 (pre-release), 94 bytes





                                                      lambda l:[s for n in range(10**5)if all(''in[x:=x[x[:1]==c:]for c in(s:='%05d'%n)]for x in l)]


                                                      Try it online!



                                                      Behold the power of assignment expressions!. Uses the method from here for checking subsequences.






                                                      share|improve this answer











                                                      $endgroup$


















                                                        5












                                                        $begingroup$


                                                        Python 3, 98 bytes





                                                        f=lambda l,s='':any(l)or print(s)if s[4:]else[f([x[x[:1]==c:]for x in l],s+c)for c in'0123456789']


                                                        Try it online!



                                                        Recursively tries building every five-digit number string in s, tracking the subsequences in l still remaining to be hit. If all are empty by the end, prints the result.




                                                        Python 3.8 (pre-release), 94 bytes





                                                        lambda l:[s for n in range(10**5)if all(''in[x:=x[x[:1]==c:]for c in(s:='%05d'%n)]for x in l)]


                                                        Try it online!



                                                        Behold the power of assignment expressions!. Uses the method from here for checking subsequences.






                                                        share|improve this answer











                                                        $endgroup$
















                                                          5












                                                          5








                                                          5





                                                          $begingroup$


                                                          Python 3, 98 bytes





                                                          f=lambda l,s='':any(l)or print(s)if s[4:]else[f([x[x[:1]==c:]for x in l],s+c)for c in'0123456789']


                                                          Try it online!



                                                          Recursively tries building every five-digit number string in s, tracking the subsequences in l still remaining to be hit. If all are empty by the end, prints the result.




                                                          Python 3.8 (pre-release), 94 bytes





                                                          lambda l:[s for n in range(10**5)if all(''in[x:=x[x[:1]==c:]for c in(s:='%05d'%n)]for x in l)]


                                                          Try it online!



                                                          Behold the power of assignment expressions!. Uses the method from here for checking subsequences.






                                                          share|improve this answer











                                                          $endgroup$




                                                          Python 3, 98 bytes





                                                          f=lambda l,s='':any(l)or print(s)if s[4:]else[f([x[x[:1]==c:]for x in l],s+c)for c in'0123456789']


                                                          Try it online!



                                                          Recursively tries building every five-digit number string in s, tracking the subsequences in l still remaining to be hit. If all are empty by the end, prints the result.




                                                          Python 3.8 (pre-release), 94 bytes





                                                          lambda l:[s for n in range(10**5)if all(''in[x:=x[x[:1]==c:]for c in(s:='%05d'%n)]for x in l)]


                                                          Try it online!



                                                          Behold the power of assignment expressions!. Uses the method from here for checking subsequences.







                                                          share|improve this answer














                                                          share|improve this answer



                                                          share|improve this answer








                                                          edited yesterday

























                                                          answered yesterday









                                                          xnorxnor

                                                          91.1k18186442




                                                          91.1k18186442























                                                              4












                                                              $begingroup$


                                                              Perl 5 -a, 80 bytes





                                                              map{s||($t=0)x(5-y///c)|e;for$b(map s//.*/gr,@F){/$b/&&$t++}$t==@F&&say}0..99999


                                                              Try it online!






                                                              share|improve this answer









                                                              $endgroup$









                                                              • 1




                                                                $begingroup$
                                                                $t+=/$b/ instead of /$b/&&$t++
                                                                $endgroup$
                                                                – Nahuel Fouilleul
                                                                2 days ago
















                                                              4












                                                              $begingroup$


                                                              Perl 5 -a, 80 bytes





                                                              map{s||($t=0)x(5-y///c)|e;for$b(map s//.*/gr,@F){/$b/&&$t++}$t==@F&&say}0..99999


                                                              Try it online!






                                                              share|improve this answer









                                                              $endgroup$









                                                              • 1




                                                                $begingroup$
                                                                $t+=/$b/ instead of /$b/&&$t++
                                                                $endgroup$
                                                                – Nahuel Fouilleul
                                                                2 days ago














                                                              4












                                                              4








                                                              4





                                                              $begingroup$


                                                              Perl 5 -a, 80 bytes





                                                              map{s||($t=0)x(5-y///c)|e;for$b(map s//.*/gr,@F){/$b/&&$t++}$t==@F&&say}0..99999


                                                              Try it online!






                                                              share|improve this answer









                                                              $endgroup$




                                                              Perl 5 -a, 80 bytes





                                                              map{s||($t=0)x(5-y///c)|e;for$b(map s//.*/gr,@F){/$b/&&$t++}$t==@F&&say}0..99999


                                                              Try it online!







                                                              share|improve this answer












                                                              share|improve this answer



                                                              share|improve this answer










                                                              answered 2 days ago









                                                              XcaliXcali

                                                              5,375520




                                                              5,375520








                                                              • 1




                                                                $begingroup$
                                                                $t+=/$b/ instead of /$b/&&$t++
                                                                $endgroup$
                                                                – Nahuel Fouilleul
                                                                2 days ago














                                                              • 1




                                                                $begingroup$
                                                                $t+=/$b/ instead of /$b/&&$t++
                                                                $endgroup$
                                                                – Nahuel Fouilleul
                                                                2 days ago








                                                              1




                                                              1




                                                              $begingroup$
                                                              $t+=/$b/ instead of /$b/&&$t++
                                                              $endgroup$
                                                              – Nahuel Fouilleul
                                                              2 days ago




                                                              $begingroup$
                                                              $t+=/$b/ instead of /$b/&&$t++
                                                              $endgroup$
                                                              – Nahuel Fouilleul
                                                              2 days ago











                                                              4












                                                              $begingroup$


                                                              Retina, 53 bytes



                                                              ~(`
                                                              .$*
                                                              m`^
                                                              G`
                                                              ^
                                                              K`¶5+%`$$¶0"1"2"3"4"5"6"7"8"9¶
                                                              "
                                                              $$
                                                              "


                                                              Try it online! Explanation:



                                                              ~(`


                                                              After executing the script, take the result as a new script, and execute that, too.



                                                              .$*


                                                              Insert .* everywhere. This results in .*3.*2.*0.* although we only need 3.*2.*0, not that it matters.



                                                              m`^
                                                              G`


                                                              Insert a G` at the start of each line. This turns it into a Retina Grep command.



                                                              ^
                                                              K`¶5+%`$$¶0"1"2"3"4"5"6"7"8"9¶
                                                              "
                                                              $$
                                                              "


                                                              Prefix two more Retina commands. The resulting script will therefore look something like this:



                                                              K`


                                                              Clear the buffer (which contains the original input).



                                                              5+


                                                              Repeat 5 times...



                                                              %`$


                                                              ... append to each line...



                                                              0$"1$"2$"3$"4$"5$"6$"7$"8$"9


                                                              ... the digit 0, then a copy of the line, then the digit 1, etc. until 9. This means that after n loops you will have all n-digit numbers.



                                                              G`.*3.*2.*0.*
                                                              G`.*7.*2.*3.*
                                                              G`.*7.*3.*0.*


                                                              Filter out the possible numbers based on the input.






                                                              share|improve this answer









                                                              $endgroup$


















                                                                4












                                                                $begingroup$


                                                                Retina, 53 bytes



                                                                ~(`
                                                                .$*
                                                                m`^
                                                                G`
                                                                ^
                                                                K`¶5+%`$$¶0"1"2"3"4"5"6"7"8"9¶
                                                                "
                                                                $$
                                                                "


                                                                Try it online! Explanation:



                                                                ~(`


                                                                After executing the script, take the result as a new script, and execute that, too.



                                                                .$*


                                                                Insert .* everywhere. This results in .*3.*2.*0.* although we only need 3.*2.*0, not that it matters.



                                                                m`^
                                                                G`


                                                                Insert a G` at the start of each line. This turns it into a Retina Grep command.



                                                                ^
                                                                K`¶5+%`$$¶0"1"2"3"4"5"6"7"8"9¶
                                                                "
                                                                $$
                                                                "


                                                                Prefix two more Retina commands. The resulting script will therefore look something like this:



                                                                K`


                                                                Clear the buffer (which contains the original input).



                                                                5+


                                                                Repeat 5 times...



                                                                %`$


                                                                ... append to each line...



                                                                0$"1$"2$"3$"4$"5$"6$"7$"8$"9


                                                                ... the digit 0, then a copy of the line, then the digit 1, etc. until 9. This means that after n loops you will have all n-digit numbers.



                                                                G`.*3.*2.*0.*
                                                                G`.*7.*2.*3.*
                                                                G`.*7.*3.*0.*


                                                                Filter out the possible numbers based on the input.






                                                                share|improve this answer









                                                                $endgroup$
















                                                                  4












                                                                  4








                                                                  4





                                                                  $begingroup$


                                                                  Retina, 53 bytes



                                                                  ~(`
                                                                  .$*
                                                                  m`^
                                                                  G`
                                                                  ^
                                                                  K`¶5+%`$$¶0"1"2"3"4"5"6"7"8"9¶
                                                                  "
                                                                  $$
                                                                  "


                                                                  Try it online! Explanation:



                                                                  ~(`


                                                                  After executing the script, take the result as a new script, and execute that, too.



                                                                  .$*


                                                                  Insert .* everywhere. This results in .*3.*2.*0.* although we only need 3.*2.*0, not that it matters.



                                                                  m`^
                                                                  G`


                                                                  Insert a G` at the start of each line. This turns it into a Retina Grep command.



                                                                  ^
                                                                  K`¶5+%`$$¶0"1"2"3"4"5"6"7"8"9¶
                                                                  "
                                                                  $$
                                                                  "


                                                                  Prefix two more Retina commands. The resulting script will therefore look something like this:



                                                                  K`


                                                                  Clear the buffer (which contains the original input).



                                                                  5+


                                                                  Repeat 5 times...



                                                                  %`$


                                                                  ... append to each line...



                                                                  0$"1$"2$"3$"4$"5$"6$"7$"8$"9


                                                                  ... the digit 0, then a copy of the line, then the digit 1, etc. until 9. This means that after n loops you will have all n-digit numbers.



                                                                  G`.*3.*2.*0.*
                                                                  G`.*7.*2.*3.*
                                                                  G`.*7.*3.*0.*


                                                                  Filter out the possible numbers based on the input.






                                                                  share|improve this answer









                                                                  $endgroup$




                                                                  Retina, 53 bytes



                                                                  ~(`
                                                                  .$*
                                                                  m`^
                                                                  G`
                                                                  ^
                                                                  K`¶5+%`$$¶0"1"2"3"4"5"6"7"8"9¶
                                                                  "
                                                                  $$
                                                                  "


                                                                  Try it online! Explanation:



                                                                  ~(`


                                                                  After executing the script, take the result as a new script, and execute that, too.



                                                                  .$*


                                                                  Insert .* everywhere. This results in .*3.*2.*0.* although we only need 3.*2.*0, not that it matters.



                                                                  m`^
                                                                  G`


                                                                  Insert a G` at the start of each line. This turns it into a Retina Grep command.



                                                                  ^
                                                                  K`¶5+%`$$¶0"1"2"3"4"5"6"7"8"9¶
                                                                  "
                                                                  $$
                                                                  "


                                                                  Prefix two more Retina commands. The resulting script will therefore look something like this:



                                                                  K`


                                                                  Clear the buffer (which contains the original input).



                                                                  5+


                                                                  Repeat 5 times...



                                                                  %`$


                                                                  ... append to each line...



                                                                  0$"1$"2$"3$"4$"5$"6$"7$"8$"9


                                                                  ... the digit 0, then a copy of the line, then the digit 1, etc. until 9. This means that after n loops you will have all n-digit numbers.



                                                                  G`.*3.*2.*0.*
                                                                  G`.*7.*2.*3.*
                                                                  G`.*7.*3.*0.*


                                                                  Filter out the possible numbers based on the input.







                                                                  share|improve this answer












                                                                  share|improve this answer



                                                                  share|improve this answer










                                                                  answered 2 days ago









                                                                  NeilNeil

                                                                  81k744178




                                                                  81k744178























                                                                      4












                                                                      $begingroup$


                                                                      R, 80 82 bytes





                                                                      Reduce(intersect,lapply(gsub("",".*",scan(,"")),grep,sprintf("%05d",0:99999),v=T))


                                                                      Here’s a base R solution using regex. Writing this nested series of functions made me realise how much I’ve learned to appreciate the magrittr package!



                                                                      Initially hadn’t read rules on input, so now reads from stdin (thanks @KirillL).



                                                                      Try it online!






                                                                      share|improve this answer











                                                                      $endgroup$













                                                                      • $begingroup$
                                                                        @digEmAll it says it’s 82 bytes doesn’t it? You can’t use integers because of potential for leading zeroes in the input.
                                                                        $endgroup$
                                                                        – Nick Kennedy
                                                                        yesterday










                                                                      • $begingroup$
                                                                        Sorry, I read the title and unconsciously I picked the minimum number without noticing that it was strikedthrough... and yes, sorry again you're right about the string input ;)
                                                                        $endgroup$
                                                                        – digEmAll
                                                                        yesterday


















                                                                      4












                                                                      $begingroup$


                                                                      R, 80 82 bytes





                                                                      Reduce(intersect,lapply(gsub("",".*",scan(,"")),grep,sprintf("%05d",0:99999),v=T))


                                                                      Here’s a base R solution using regex. Writing this nested series of functions made me realise how much I’ve learned to appreciate the magrittr package!



                                                                      Initially hadn’t read rules on input, so now reads from stdin (thanks @KirillL).



                                                                      Try it online!






                                                                      share|improve this answer











                                                                      $endgroup$













                                                                      • $begingroup$
                                                                        @digEmAll it says it’s 82 bytes doesn’t it? You can’t use integers because of potential for leading zeroes in the input.
                                                                        $endgroup$
                                                                        – Nick Kennedy
                                                                        yesterday










                                                                      • $begingroup$
                                                                        Sorry, I read the title and unconsciously I picked the minimum number without noticing that it was strikedthrough... and yes, sorry again you're right about the string input ;)
                                                                        $endgroup$
                                                                        – digEmAll
                                                                        yesterday
















                                                                      4












                                                                      4








                                                                      4





                                                                      $begingroup$


                                                                      R, 80 82 bytes





                                                                      Reduce(intersect,lapply(gsub("",".*",scan(,"")),grep,sprintf("%05d",0:99999),v=T))


                                                                      Here’s a base R solution using regex. Writing this nested series of functions made me realise how much I’ve learned to appreciate the magrittr package!



                                                                      Initially hadn’t read rules on input, so now reads from stdin (thanks @KirillL).



                                                                      Try it online!






                                                                      share|improve this answer











                                                                      $endgroup$




                                                                      R, 80 82 bytes





                                                                      Reduce(intersect,lapply(gsub("",".*",scan(,"")),grep,sprintf("%05d",0:99999),v=T))


                                                                      Here’s a base R solution using regex. Writing this nested series of functions made me realise how much I’ve learned to appreciate the magrittr package!



                                                                      Initially hadn’t read rules on input, so now reads from stdin (thanks @KirillL).



                                                                      Try it online!







                                                                      share|improve this answer














                                                                      share|improve this answer



                                                                      share|improve this answer








                                                                      edited 2 days ago

























                                                                      answered 2 days ago









                                                                      Nick KennedyNick Kennedy

                                                                      20114




                                                                      20114












                                                                      • $begingroup$
                                                                        @digEmAll it says it’s 82 bytes doesn’t it? You can’t use integers because of potential for leading zeroes in the input.
                                                                        $endgroup$
                                                                        – Nick Kennedy
                                                                        yesterday










                                                                      • $begingroup$
                                                                        Sorry, I read the title and unconsciously I picked the minimum number without noticing that it was strikedthrough... and yes, sorry again you're right about the string input ;)
                                                                        $endgroup$
                                                                        – digEmAll
                                                                        yesterday




















                                                                      • $begingroup$
                                                                        @digEmAll it says it’s 82 bytes doesn’t it? You can’t use integers because of potential for leading zeroes in the input.
                                                                        $endgroup$
                                                                        – Nick Kennedy
                                                                        yesterday










                                                                      • $begingroup$
                                                                        Sorry, I read the title and unconsciously I picked the minimum number without noticing that it was strikedthrough... and yes, sorry again you're right about the string input ;)
                                                                        $endgroup$
                                                                        – digEmAll
                                                                        yesterday


















                                                                      $begingroup$
                                                                      @digEmAll it says it’s 82 bytes doesn’t it? You can’t use integers because of potential for leading zeroes in the input.
                                                                      $endgroup$
                                                                      – Nick Kennedy
                                                                      yesterday




                                                                      $begingroup$
                                                                      @digEmAll it says it’s 82 bytes doesn’t it? You can’t use integers because of potential for leading zeroes in the input.
                                                                      $endgroup$
                                                                      – Nick Kennedy
                                                                      yesterday












                                                                      $begingroup$
                                                                      Sorry, I read the title and unconsciously I picked the minimum number without noticing that it was strikedthrough... and yes, sorry again you're right about the string input ;)
                                                                      $endgroup$
                                                                      – digEmAll
                                                                      yesterday






                                                                      $begingroup$
                                                                      Sorry, I read the title and unconsciously I picked the minimum number without noticing that it was strikedthrough... and yes, sorry again you're right about the string input ;)
                                                                      $endgroup$
                                                                      – digEmAll
                                                                      yesterday













                                                                      2












                                                                      $begingroup$


                                                                      Ruby, 79 77 bytes





                                                                      ->x{(0...1e5).map{|i|'%05d'%i}.select{|i|x.all?{|c|i=~/#{c.gsub('','.*')}/}}}


                                                                      Try it online!



                                                                      Input is an array of strings.



                                                                      Here's a more readable version of the same code:



                                                                      def f(codes)
                                                                      (0...10**5).map{|i| '%05d'%i}.select do |i|
                                                                      codes.all? do |code|
                                                                      i =~ Regexp.new(code.chars.join('.*'))
                                                                      end
                                                                      end
                                                                      end





                                                                      share|improve this answer











                                                                      $endgroup$













                                                                      • $begingroup$
                                                                        BTW, your approach can also be made shorter by switching to char array input, as in my version, and -2 more bytes by formatting the upper value as 1e5, like this
                                                                        $endgroup$
                                                                        – Kirill L.
                                                                        2 days ago












                                                                      • $begingroup$
                                                                        @KirillL. Thanks for the -2 bytes. I won't change the input format because my answer would look too much like yours. Cheers!
                                                                        $endgroup$
                                                                        – Eric Duminil
                                                                        2 days ago
















                                                                      2












                                                                      $begingroup$


                                                                      Ruby, 79 77 bytes





                                                                      ->x{(0...1e5).map{|i|'%05d'%i}.select{|i|x.all?{|c|i=~/#{c.gsub('','.*')}/}}}


                                                                      Try it online!



                                                                      Input is an array of strings.



                                                                      Here's a more readable version of the same code:



                                                                      def f(codes)
                                                                      (0...10**5).map{|i| '%05d'%i}.select do |i|
                                                                      codes.all? do |code|
                                                                      i =~ Regexp.new(code.chars.join('.*'))
                                                                      end
                                                                      end
                                                                      end





                                                                      share|improve this answer











                                                                      $endgroup$













                                                                      • $begingroup$
                                                                        BTW, your approach can also be made shorter by switching to char array input, as in my version, and -2 more bytes by formatting the upper value as 1e5, like this
                                                                        $endgroup$
                                                                        – Kirill L.
                                                                        2 days ago












                                                                      • $begingroup$
                                                                        @KirillL. Thanks for the -2 bytes. I won't change the input format because my answer would look too much like yours. Cheers!
                                                                        $endgroup$
                                                                        – Eric Duminil
                                                                        2 days ago














                                                                      2












                                                                      2








                                                                      2





                                                                      $begingroup$


                                                                      Ruby, 79 77 bytes





                                                                      ->x{(0...1e5).map{|i|'%05d'%i}.select{|i|x.all?{|c|i=~/#{c.gsub('','.*')}/}}}


                                                                      Try it online!



                                                                      Input is an array of strings.



                                                                      Here's a more readable version of the same code:



                                                                      def f(codes)
                                                                      (0...10**5).map{|i| '%05d'%i}.select do |i|
                                                                      codes.all? do |code|
                                                                      i =~ Regexp.new(code.chars.join('.*'))
                                                                      end
                                                                      end
                                                                      end





                                                                      share|improve this answer











                                                                      $endgroup$




                                                                      Ruby, 79 77 bytes





                                                                      ->x{(0...1e5).map{|i|'%05d'%i}.select{|i|x.all?{|c|i=~/#{c.gsub('','.*')}/}}}


                                                                      Try it online!



                                                                      Input is an array of strings.



                                                                      Here's a more readable version of the same code:



                                                                      def f(codes)
                                                                      (0...10**5).map{|i| '%05d'%i}.select do |i|
                                                                      codes.all? do |code|
                                                                      i =~ Regexp.new(code.chars.join('.*'))
                                                                      end
                                                                      end
                                                                      end






                                                                      share|improve this answer














                                                                      share|improve this answer



                                                                      share|improve this answer








                                                                      edited 2 days ago

























                                                                      answered 2 days ago









                                                                      Eric DuminilEric Duminil

                                                                      43128




                                                                      43128












                                                                      • $begingroup$
                                                                        BTW, your approach can also be made shorter by switching to char array input, as in my version, and -2 more bytes by formatting the upper value as 1e5, like this
                                                                        $endgroup$
                                                                        – Kirill L.
                                                                        2 days ago












                                                                      • $begingroup$
                                                                        @KirillL. Thanks for the -2 bytes. I won't change the input format because my answer would look too much like yours. Cheers!
                                                                        $endgroup$
                                                                        – Eric Duminil
                                                                        2 days ago


















                                                                      • $begingroup$
                                                                        BTW, your approach can also be made shorter by switching to char array input, as in my version, and -2 more bytes by formatting the upper value as 1e5, like this
                                                                        $endgroup$
                                                                        – Kirill L.
                                                                        2 days ago












                                                                      • $begingroup$
                                                                        @KirillL. Thanks for the -2 bytes. I won't change the input format because my answer would look too much like yours. Cheers!
                                                                        $endgroup$
                                                                        – Eric Duminil
                                                                        2 days ago
















                                                                      $begingroup$
                                                                      BTW, your approach can also be made shorter by switching to char array input, as in my version, and -2 more bytes by formatting the upper value as 1e5, like this
                                                                      $endgroup$
                                                                      – Kirill L.
                                                                      2 days ago






                                                                      $begingroup$
                                                                      BTW, your approach can also be made shorter by switching to char array input, as in my version, and -2 more bytes by formatting the upper value as 1e5, like this
                                                                      $endgroup$
                                                                      – Kirill L.
                                                                      2 days ago














                                                                      $begingroup$
                                                                      @KirillL. Thanks for the -2 bytes. I won't change the input format because my answer would look too much like yours. Cheers!
                                                                      $endgroup$
                                                                      – Eric Duminil
                                                                      2 days ago




                                                                      $begingroup$
                                                                      @KirillL. Thanks for the -2 bytes. I won't change the input format because my answer would look too much like yours. Cheers!
                                                                      $endgroup$
                                                                      – Eric Duminil
                                                                      2 days ago











                                                                      2












                                                                      $begingroup$


                                                                      J, 52 bytes



                                                                      (>,{;^:4~i.10)([#~]*/@e."2((#~3=+/"1)#:i.32)#"_ 1[)]


                                                                      Try it online!






                                                                      share|improve this answer











                                                                      $endgroup$


















                                                                        2












                                                                        $begingroup$


                                                                        J, 52 bytes



                                                                        (>,{;^:4~i.10)([#~]*/@e."2((#~3=+/"1)#:i.32)#"_ 1[)]


                                                                        Try it online!






                                                                        share|improve this answer











                                                                        $endgroup$
















                                                                          2












                                                                          2








                                                                          2





                                                                          $begingroup$


                                                                          J, 52 bytes



                                                                          (>,{;^:4~i.10)([#~]*/@e."2((#~3=+/"1)#:i.32)#"_ 1[)]


                                                                          Try it online!






                                                                          share|improve this answer











                                                                          $endgroup$




                                                                          J, 52 bytes



                                                                          (>,{;^:4~i.10)([#~]*/@e."2((#~3=+/"1)#:i.32)#"_ 1[)]


                                                                          Try it online!







                                                                          share|improve this answer














                                                                          share|improve this answer



                                                                          share|improve this answer








                                                                          edited yesterday

























                                                                          answered 2 days ago









                                                                          JonahJonah

                                                                          2,331916




                                                                          2,331916























                                                                              1












                                                                              $begingroup$

                                                                              PHP 128 bytes





                                                                              for(;$i++<1e5;$k>$argc||print$s)for($k=0;$n=$argv[++$k];)preg_match("/$n[0].*$n[1].*$n[2]/",$s=sprintf("%05d
                                                                              ",$i-1))||$k=$argc;


                                                                              or



                                                                              for(;$i<1e5;$i+=$k<$argc||print$s)for($k=0;$n=$argv[++$k];)if(!preg_match("/$n[0].*$n[1].*$n[2]/",$s=sprintf("%05d
                                                                              ",$i)))break;


                                                                              take input from command line arguments. Run with -nr or try them online.






                                                                              share|improve this answer









                                                                              $endgroup$


















                                                                                1












                                                                                $begingroup$

                                                                                PHP 128 bytes





                                                                                for(;$i++<1e5;$k>$argc||print$s)for($k=0;$n=$argv[++$k];)preg_match("/$n[0].*$n[1].*$n[2]/",$s=sprintf("%05d
                                                                                ",$i-1))||$k=$argc;


                                                                                or



                                                                                for(;$i<1e5;$i+=$k<$argc||print$s)for($k=0;$n=$argv[++$k];)if(!preg_match("/$n[0].*$n[1].*$n[2]/",$s=sprintf("%05d
                                                                                ",$i)))break;


                                                                                take input from command line arguments. Run with -nr or try them online.






                                                                                share|improve this answer









                                                                                $endgroup$
















                                                                                  1












                                                                                  1








                                                                                  1





                                                                                  $begingroup$

                                                                                  PHP 128 bytes





                                                                                  for(;$i++<1e5;$k>$argc||print$s)for($k=0;$n=$argv[++$k];)preg_match("/$n[0].*$n[1].*$n[2]/",$s=sprintf("%05d
                                                                                  ",$i-1))||$k=$argc;


                                                                                  or



                                                                                  for(;$i<1e5;$i+=$k<$argc||print$s)for($k=0;$n=$argv[++$k];)if(!preg_match("/$n[0].*$n[1].*$n[2]/",$s=sprintf("%05d
                                                                                  ",$i)))break;


                                                                                  take input from command line arguments. Run with -nr or try them online.






                                                                                  share|improve this answer









                                                                                  $endgroup$



                                                                                  PHP 128 bytes





                                                                                  for(;$i++<1e5;$k>$argc||print$s)for($k=0;$n=$argv[++$k];)preg_match("/$n[0].*$n[1].*$n[2]/",$s=sprintf("%05d
                                                                                  ",$i-1))||$k=$argc;


                                                                                  or



                                                                                  for(;$i<1e5;$i+=$k<$argc||print$s)for($k=0;$n=$argv[++$k];)if(!preg_match("/$n[0].*$n[1].*$n[2]/",$s=sprintf("%05d
                                                                                  ",$i)))break;


                                                                                  take input from command line arguments. Run with -nr or try them online.







                                                                                  share|improve this answer












                                                                                  share|improve this answer



                                                                                  share|improve this answer










                                                                                  answered yesterday









                                                                                  TitusTitus

                                                                                  13.2k11238




                                                                                  13.2k11238























                                                                                      1












                                                                                      $begingroup$


                                                                                      C# (Visual C# Interactive Compiler), 111 bytes





                                                                                      x=>{for(int i=0;i<1e5;){var s=$"{i++:D5}";if(x.All(t=>t.Aggregate(0,(a,c)=>a<0?a:s.IndexOf(c,a))>0))Print(s);}}


                                                                                      Try it online!



                                                                                      // x: input list of strings
                                                                                      x=>{
                                                                                      // generate all numbers under 100k
                                                                                      for(int i=0;i<1e5;){
                                                                                      // convert the current number to
                                                                                      // a 5 digit string padded with 0's
                                                                                      var s=$"{i++:D5}";
                                                                                      // test all inputs against the 5 digit
                                                                                      // string using an aggregate.
                                                                                      // each step of the aggregate gets
                                                                                      // the index of the next occurrence
                                                                                      // of the current character starting
                                                                                      // at the previously found character.
                                                                                      // a negative index indicates error.
                                                                                      if(x.All(t=>t
                                                                                      .Aggregate(0,(a,c)=>
                                                                                      a<0
                                                                                      ?a
                                                                                      :s.IndexOf(c,a))>0))
                                                                                      // output to STDOUT
                                                                                      Print(s);
                                                                                      }
                                                                                      }





                                                                                      share|improve this answer











                                                                                      $endgroup$


















                                                                                        1












                                                                                        $begingroup$


                                                                                        C# (Visual C# Interactive Compiler), 111 bytes





                                                                                        x=>{for(int i=0;i<1e5;){var s=$"{i++:D5}";if(x.All(t=>t.Aggregate(0,(a,c)=>a<0?a:s.IndexOf(c,a))>0))Print(s);}}


                                                                                        Try it online!



                                                                                        // x: input list of strings
                                                                                        x=>{
                                                                                        // generate all numbers under 100k
                                                                                        for(int i=0;i<1e5;){
                                                                                        // convert the current number to
                                                                                        // a 5 digit string padded with 0's
                                                                                        var s=$"{i++:D5}";
                                                                                        // test all inputs against the 5 digit
                                                                                        // string using an aggregate.
                                                                                        // each step of the aggregate gets
                                                                                        // the index of the next occurrence
                                                                                        // of the current character starting
                                                                                        // at the previously found character.
                                                                                        // a negative index indicates error.
                                                                                        if(x.All(t=>t
                                                                                        .Aggregate(0,(a,c)=>
                                                                                        a<0
                                                                                        ?a
                                                                                        :s.IndexOf(c,a))>0))
                                                                                        // output to STDOUT
                                                                                        Print(s);
                                                                                        }
                                                                                        }





                                                                                        share|improve this answer











                                                                                        $endgroup$
















                                                                                          1












                                                                                          1








                                                                                          1





                                                                                          $begingroup$


                                                                                          C# (Visual C# Interactive Compiler), 111 bytes





                                                                                          x=>{for(int i=0;i<1e5;){var s=$"{i++:D5}";if(x.All(t=>t.Aggregate(0,(a,c)=>a<0?a:s.IndexOf(c,a))>0))Print(s);}}


                                                                                          Try it online!



                                                                                          // x: input list of strings
                                                                                          x=>{
                                                                                          // generate all numbers under 100k
                                                                                          for(int i=0;i<1e5;){
                                                                                          // convert the current number to
                                                                                          // a 5 digit string padded with 0's
                                                                                          var s=$"{i++:D5}";
                                                                                          // test all inputs against the 5 digit
                                                                                          // string using an aggregate.
                                                                                          // each step of the aggregate gets
                                                                                          // the index of the next occurrence
                                                                                          // of the current character starting
                                                                                          // at the previously found character.
                                                                                          // a negative index indicates error.
                                                                                          if(x.All(t=>t
                                                                                          .Aggregate(0,(a,c)=>
                                                                                          a<0
                                                                                          ?a
                                                                                          :s.IndexOf(c,a))>0))
                                                                                          // output to STDOUT
                                                                                          Print(s);
                                                                                          }
                                                                                          }





                                                                                          share|improve this answer











                                                                                          $endgroup$




                                                                                          C# (Visual C# Interactive Compiler), 111 bytes





                                                                                          x=>{for(int i=0;i<1e5;){var s=$"{i++:D5}";if(x.All(t=>t.Aggregate(0,(a,c)=>a<0?a:s.IndexOf(c,a))>0))Print(s);}}


                                                                                          Try it online!



                                                                                          // x: input list of strings
                                                                                          x=>{
                                                                                          // generate all numbers under 100k
                                                                                          for(int i=0;i<1e5;){
                                                                                          // convert the current number to
                                                                                          // a 5 digit string padded with 0's
                                                                                          var s=$"{i++:D5}";
                                                                                          // test all inputs against the 5 digit
                                                                                          // string using an aggregate.
                                                                                          // each step of the aggregate gets
                                                                                          // the index of the next occurrence
                                                                                          // of the current character starting
                                                                                          // at the previously found character.
                                                                                          // a negative index indicates error.
                                                                                          if(x.All(t=>t
                                                                                          .Aggregate(0,(a,c)=>
                                                                                          a<0
                                                                                          ?a
                                                                                          :s.IndexOf(c,a))>0))
                                                                                          // output to STDOUT
                                                                                          Print(s);
                                                                                          }
                                                                                          }






                                                                                          share|improve this answer














                                                                                          share|improve this answer



                                                                                          share|improve this answer








                                                                                          edited yesterday

























                                                                                          answered yesterday









                                                                                          danadana

                                                                                          1,151166




                                                                                          1,151166























                                                                                              1












                                                                                              $begingroup$

                                                                                              Japt, 23 bytes



                                                                                              1e5o ù'0 fA{Ue@AèXË+".*


                                                                                              Try it!



                                                                                              1e5o ù'0 fA{Ue@AèXË+".*    # full program

                                                                                              1e5o # generate numbers under 100k
                                                                                              ù'0 # left pad with 0's
                                                                                              fA{ # filter array
                                                                                              Ue@ # check every element of input array
                                                                                              Aè # A is the number to be tested.
                                                                                              # test it against a regex.
                                                                                              Ë+".* # the regex is an element from the input array
                                                                                              # with wildcards injected between each character





                                                                                              share|improve this answer











                                                                                              $endgroup$













                                                                                              • $begingroup$
                                                                                                less useless variables: 1e5o ù'0 fA{Ue@AèX®+".* :P
                                                                                                $endgroup$
                                                                                                – ASCII-only
                                                                                                7 hours ago










                                                                                              • $begingroup$
                                                                                                also 23: 1e5o ù'0 fA{Ue@AèX¬q".*
                                                                                                $endgroup$
                                                                                                – ASCII-only
                                                                                                6 hours ago










                                                                                              • $begingroup$
                                                                                                21 bytes
                                                                                                $endgroup$
                                                                                                – Shaggy
                                                                                                1 hour ago
















                                                                                              1












                                                                                              $begingroup$

                                                                                              Japt, 23 bytes



                                                                                              1e5o ù'0 fA{Ue@AèXË+".*


                                                                                              Try it!



                                                                                              1e5o ù'0 fA{Ue@AèXË+".*    # full program

                                                                                              1e5o # generate numbers under 100k
                                                                                              ù'0 # left pad with 0's
                                                                                              fA{ # filter array
                                                                                              Ue@ # check every element of input array
                                                                                              Aè # A is the number to be tested.
                                                                                              # test it against a regex.
                                                                                              Ë+".* # the regex is an element from the input array
                                                                                              # with wildcards injected between each character





                                                                                              share|improve this answer











                                                                                              $endgroup$













                                                                                              • $begingroup$
                                                                                                less useless variables: 1e5o ù'0 fA{Ue@AèX®+".* :P
                                                                                                $endgroup$
                                                                                                – ASCII-only
                                                                                                7 hours ago










                                                                                              • $begingroup$
                                                                                                also 23: 1e5o ù'0 fA{Ue@AèX¬q".*
                                                                                                $endgroup$
                                                                                                – ASCII-only
                                                                                                6 hours ago










                                                                                              • $begingroup$
                                                                                                21 bytes
                                                                                                $endgroup$
                                                                                                – Shaggy
                                                                                                1 hour ago














                                                                                              1












                                                                                              1








                                                                                              1





                                                                                              $begingroup$

                                                                                              Japt, 23 bytes



                                                                                              1e5o ù'0 fA{Ue@AèXË+".*


                                                                                              Try it!



                                                                                              1e5o ù'0 fA{Ue@AèXË+".*    # full program

                                                                                              1e5o # generate numbers under 100k
                                                                                              ù'0 # left pad with 0's
                                                                                              fA{ # filter array
                                                                                              Ue@ # check every element of input array
                                                                                              Aè # A is the number to be tested.
                                                                                              # test it against a regex.
                                                                                              Ë+".* # the regex is an element from the input array
                                                                                              # with wildcards injected between each character





                                                                                              share|improve this answer











                                                                                              $endgroup$



                                                                                              Japt, 23 bytes



                                                                                              1e5o ù'0 fA{Ue@AèXË+".*


                                                                                              Try it!



                                                                                              1e5o ù'0 fA{Ue@AèXË+".*    # full program

                                                                                              1e5o # generate numbers under 100k
                                                                                              ù'0 # left pad with 0's
                                                                                              fA{ # filter array
                                                                                              Ue@ # check every element of input array
                                                                                              Aè # A is the number to be tested.
                                                                                              # test it against a regex.
                                                                                              Ë+".* # the regex is an element from the input array
                                                                                              # with wildcards injected between each character






                                                                                              share|improve this answer














                                                                                              share|improve this answer



                                                                                              share|improve this answer








                                                                                              edited 10 hours ago

























                                                                                              answered 13 hours ago









                                                                                              danadana

                                                                                              1,151166




                                                                                              1,151166












                                                                                              • $begingroup$
                                                                                                less useless variables: 1e5o ù'0 fA{Ue@AèX®+".* :P
                                                                                                $endgroup$
                                                                                                – ASCII-only
                                                                                                7 hours ago










                                                                                              • $begingroup$
                                                                                                also 23: 1e5o ù'0 fA{Ue@AèX¬q".*
                                                                                                $endgroup$
                                                                                                – ASCII-only
                                                                                                6 hours ago










                                                                                              • $begingroup$
                                                                                                21 bytes
                                                                                                $endgroup$
                                                                                                – Shaggy
                                                                                                1 hour ago


















                                                                                              • $begingroup$
                                                                                                less useless variables: 1e5o ù'0 fA{Ue@AèX®+".* :P
                                                                                                $endgroup$
                                                                                                – ASCII-only
                                                                                                7 hours ago










                                                                                              • $begingroup$
                                                                                                also 23: 1e5o ù'0 fA{Ue@AèX¬q".*
                                                                                                $endgroup$
                                                                                                – ASCII-only
                                                                                                6 hours ago










                                                                                              • $begingroup$
                                                                                                21 bytes
                                                                                                $endgroup$
                                                                                                – Shaggy
                                                                                                1 hour ago
















                                                                                              $begingroup$
                                                                                              less useless variables: 1e5o ù'0 fA{Ue@AèX®+".* :P
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              7 hours ago




                                                                                              $begingroup$
                                                                                              less useless variables: 1e5o ù'0 fA{Ue@AèX®+".* :P
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              7 hours ago












                                                                                              $begingroup$
                                                                                              also 23: 1e5o ù'0 fA{Ue@AèX¬q".*
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              6 hours ago




                                                                                              $begingroup$
                                                                                              also 23: 1e5o ù'0 fA{Ue@AèX¬q".*
                                                                                              $endgroup$
                                                                                              – ASCII-only
                                                                                              6 hours ago












                                                                                              $begingroup$
                                                                                              21 bytes
                                                                                              $endgroup$
                                                                                              – Shaggy
                                                                                              1 hour ago




                                                                                              $begingroup$
                                                                                              21 bytes
                                                                                              $endgroup$
                                                                                              – Shaggy
                                                                                              1 hour ago











                                                                                              0












                                                                                              $begingroup$


                                                                                              Clean, 113 bytes



                                                                                              import StdEnv,Data.List
                                                                                              $l=[s\s<-iter 5(p=[[c:e]\e<-p,c<-['0'..'9']])[[]]|all(flip any(subsequences s)o(==))l]


                                                                                              Try it online!






                                                                                              share|improve this answer









                                                                                              $endgroup$


















                                                                                                0












                                                                                                $begingroup$


                                                                                                Clean, 113 bytes



                                                                                                import StdEnv,Data.List
                                                                                                $l=[s\s<-iter 5(p=[[c:e]\e<-p,c<-['0'..'9']])[[]]|all(flip any(subsequences s)o(==))l]


                                                                                                Try it online!






                                                                                                share|improve this answer









                                                                                                $endgroup$
















                                                                                                  0












                                                                                                  0








                                                                                                  0





                                                                                                  $begingroup$


                                                                                                  Clean, 113 bytes



                                                                                                  import StdEnv,Data.List
                                                                                                  $l=[s\s<-iter 5(p=[[c:e]\e<-p,c<-['0'..'9']])[[]]|all(flip any(subsequences s)o(==))l]


                                                                                                  Try it online!






                                                                                                  share|improve this answer









                                                                                                  $endgroup$




                                                                                                  Clean, 113 bytes



                                                                                                  import StdEnv,Data.List
                                                                                                  $l=[s\s<-iter 5(p=[[c:e]\e<-p,c<-['0'..'9']])[[]]|all(flip any(subsequences s)o(==))l]


                                                                                                  Try it online!







                                                                                                  share|improve this answer












                                                                                                  share|improve this answer



                                                                                                  share|improve this answer










                                                                                                  answered 12 hours ago









                                                                                                  ΟurousΟurous

                                                                                                  7,19111035




                                                                                                  7,19111035






















                                                                                                      cefel is a new contributor. Be nice, and check out our Code of Conduct.










                                                                                                      draft saved

                                                                                                      draft discarded


















                                                                                                      cefel is a new contributor. Be nice, and check out our Code of Conduct.













                                                                                                      cefel is a new contributor. Be nice, and check out our Code of Conduct.












                                                                                                      cefel is a new contributor. Be nice, and check out our Code of Conduct.
















                                                                                                      If this is an answer to a challenge…




                                                                                                      • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                                                                      • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                                                        Explanations of your answer make it more interesting to read and are very much encouraged.


                                                                                                      • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.



                                                                                                      More generally…




                                                                                                      • …Please make sure to answer the question and provide sufficient detail.


                                                                                                      • …Avoid asking for help, clarification or responding to other answers (use comments instead).





                                                                                                      draft saved


                                                                                                      draft discarded














                                                                                                      StackExchange.ready(
                                                                                                      function () {
                                                                                                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f180243%2fcrack-the-bank-accounts-password%23new-answer', 'question_page');
                                                                                                      }
                                                                                                      );

                                                                                                      Post as a guest















                                                                                                      Required, but never shown





















































                                                                                                      Required, but never shown














                                                                                                      Required, but never shown












                                                                                                      Required, but never shown







                                                                                                      Required, but never shown

































                                                                                                      Required, but never shown














                                                                                                      Required, but never shown












                                                                                                      Required, but never shown







                                                                                                      Required, but never shown







                                                                                                      Popular posts from this blog

                                                                                                      Couldn't open a raw socket. Error: Permission denied (13) (nmap)Is it possible to run networking commands...

                                                                                                      VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

                                                                                                      Why not use the yoke to control yaw, as well as pitch and roll? Announcing the arrival of...