[Question]
  [
[Chef Avillez](https://en.wikipedia.org/wiki/Jos%C3%A9_Avillez) is about to cook us some really nice meal. He is just waiting for us to give him some ingredients and to request a meal.
# Task
Given a list of ingredients (strings matching `/[a-z]+/`) and a requested meal (string matching `/[a-z][a-z ]*/`) output the integer amount of meals Chef Avillez can make.
## Algorithm
Each letter (`[a-z]`) in the ingredient list contributes with one character for the soon-to-be-cooked meals. Each portion of our requested meal costs as many of each character as there are in the request string, excluding spaces.
For example, if our requested meal is `"bacon"` and the ingredients are `"banana"` and `"coconut"`, the output is `1` because in `"bananacoconut"` there is only one `b`, and for each portion of `"bacon"` we need one `"b"`.
# Input
A list of ingredients in any reasonable format, like
* a list of strings
* a list of lists of characters
* a (whatever-you-please)-separated list of ingredients, in a single string
and a requested meal in any reasonable format, like
* a string
* a list of characters
# Output
A non-negative integer representing the amount of meals that can be cooked.
# Test cases
A [Python reference implementation](https://tio.run/##hVPbbtswDH33V3B6sQ146UPfCmw/UgSDItO2OltMJRnBGuTbM1IK5LZIURgwb@ccyjJ5/Bcnco/Xa48DGKK/jXVj6MDja/tUASilJAE2gIbZhgg0QIg@JbXrBZiLOcn4immp/AsUqN0LWZdEW84bWl2Uytk8CXWXEo1pYSAPhnlZkM8CPxL/wiyPcfUOlptQIT08OMQ@ZG4HOWCJ3GVnIy6hadtrxBD/GB1QOj@zYPOswlEvqoMv7UEbcuLgOIb3thQSci8Z1C6otsvCpf6tsy/exnX8CMIQ59d4B1M0ilbRLNp3aJEWHUkA5HHULrlH@/aW203cb9YR7zD5x@rTAb23mC5gsPkiNo5chva9dQzYp8P3MNgwbc0nDAmmfUbTkqznCaJ03SfyfcjOKWmQ3w5wQy@U2T3O1lhaE54HwmNvkX@4hBP62zfQTKOTtp9lvqVv5zzwxIf7crXI1R3UBxk2O6xzCvR482iQ9zt5CUVerM4mydef5Kt9VclAlz2Uid4mWJbyyJsWm0GdBXNhoTPDLjX8/M179XGHL6q9/gc) is available.
```
['spam', 'spam', 'spam', 'spam', 'bacon', 'eggs', 'eggs', 'bacon', 'spam'], 'beans' -> 2
['bacon', 'bacon', 'bacon', 'bacon', 'bacon'], 'bacon' -> 5
['banana', 'coconut'], 'bacon' -> 1
['acon', 'bcon', 'baon', 'bacn', 'baco'], 'bacon' -> 4
['tomato', 'oregano', 'pizza', 'chocolate'], 'bacon' -> 0
['strawberries', 'figs', 'chocolate', 'sardines'], 'cod fish' -> 1
['these', 'are', 'some', 'random', 'words', 'wow'], 'or' -> 3
['some', 'more', 'delicious', 'ingredients', 'here'], 'bolognese' -> 0
['some', 'delicious', 'ingredients', 'here', 'are', 'bliss'], 'bolognese' -> 1
['some', 'bountiful', 'bagful', 'of', 'ingredients', 'here', 'are', 'bliss'], 'bolognese' -> 1
```
  
[Answer]
# [Python 2](https://docs.python.org/2/), ~~95~~ ~~71~~ ~~70~~ 55 bytes
```
lambda i,m:min(i.count(c)/m.count(c)for c in m if" "<c)
```
[Try it online!](https://tio.run/##hVHBbtswDL3nKwjtUBtxs3XdLsXcH@lyUGTZ5mCJAiUva38@I@3A24IBhQ9@It97fJTSaxkpfr707ffLZMOps4BNeAoYKzw4mmOpXP0xbLAnBgcYIQD2Bsw3V18wJOIC@TXvdtqfMHqlSOGQS4fxaQfwAdjbTsppLg34X8m74juguUhB@lmK0EKwqcqFRceYmsXqkNOEpTL3z6auhYmNDG/B/7RTlbWgOpR0vl7mFLYxSw5JGAf2HfpYMhQCRyFYyD5ZtjpbZ8RBHcXANObwg3Tt1WXwRRLnedJwLIS@kovRXhJVAfNi9rg3RyNpGtBwDbCAyuzFt@K29fXe1ObycneyjuJdA@@D44bg/hm@7lQb5VOGI6nP5YbzIJzNY/PaPDfvG9kXkRUKtpASiP1g4wITvr2t40aZN8k93Sg/iVIWtOeTZ0afldvjkP/VyCFblqcXwnEJ30GPedwyl9HnhWZ5ZVNY/vJ2HQVFZ@Iur@C8eBAv6kcNcGUHWtWdn9AhzQv/r1fX4@j5ugNNNEQdu@1xtXlX/ifnacKc/2P38Bs "Python 2 – Try It Online")
**Input**: Ingredients `i` as a comma-separated string, and a meal `m` as a string.  
**Output**: Max number of meals that can be made.
**How**: Divides the frequency of each character in the ingredient by its corresponding character in the meal, then takes the minimum.
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~55~~ 50 bytes
Meal (m) is a list of characters, and Ingredients (i) is a single string with ingredients separated by spaces.
-5 bytes from Dingus.
```
->m,i{(m-[' ']).map{|c|i.count(c)/m.count(c)}.min}
```
[Try it online!](https://tio.run/##dY3dasMwDIXv8xS6GLSFNnuA0O1B2jIcW4kFthUkh7D@PHvmNd0GY0NwkM75JMnYvs/d/jjvXuKWLuu4O6xgddrU0QyXq71SbXlMeW03z/G7vdWR0m2ePAWEHrNWAHELBHt4eqt1CJThtSnmAN2hrHkjWuJThcnNrbGcmrvCP1p9MakUWC7DmB/mQi3owi9LjzhzNJmBBXuTGAY6n8sFX04Ek7Gy7KAj9Y1mMVOLIoRanF5/IFAjjhJqxdJkj4pgpLgcEcQkxxEmFqdFp6rlwH1hsbnnsTwGh4Es8ahAqRd0hCkreBT8jf9Nfn5rA6l@AA "Ruby – Try It Online")
[Answer]
# [J](http://jsoftware.com/), 29 27 26 bytes
```
<./@(=/<.@%&(+/)]=/]);@cut
```
[Try it online!](https://tio.run/##dY7NTsMwEITvfYoRVZtGQNLycymNFIHECXHg3oOdbBKjxItsV5V64NWDE1eCQpFla@Wdb2be@4skqpCtEeEKS6z9vU7w9Pby3G@SNF9k6SbJZ/PFZRpvs3QbP@TFzvXx5PUxwWo@TbwAn@sYg3iGFaYJsnw7oaJh3CBDJCWklBEqP0JGYXM/bkTBGv@8ARingKwCov1Bwf5/5wbNqehuEAWT4BTsgucfy@WgdtwJx2BDtdCMD3U4@IDGJ7TC0fka1hmxl2SMIotK1fYbgBWmVJrsSBZc@r1tjvDtGNiQJQjjpdwRjNAld9izKa1/9yPH5mfFUdf5hiipVYXinYXStaFSkXYWDZljUW659tl0Unagz4NDCdkqa3/R/Rc "J – Try It Online")
*-2 bytes thanks to Bubbler*
*-1 byte thanks to FrownyFrog*
Inspired by [ValueInk's ruby answer](https://codegolf.stackexchange.com/a/201689/15469) -- be sure to upvote him.
Both args are strings. Meal is right arg. Ingredients are left arg and taken as space separated string.
Consider the example:
```
'banana coconut' f 'ba con'
```
`-.&' '` removes the spaces from the right arg:
```
'banana coconut' <./@(=/<.@%&(+/)]=/]) 'bacon'
```
Now the main verb is a fork whose tines are `=/` and `]=/]`. `]` is the right arg so that the right tine runs as `'bacon' =/ 'bacon'`:
```
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
```
And the left tine becomes `'banana coconut' =/ 'bacon'`:
```
1 0 0 0 0
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
1 0 0 0 0
0 1 0 0 0
0 0 0 0 1
0 1 0 0 0
0 0 0 0 1
0 1 0 0 0
0 0 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
0 0 0 0 0
0 0 0 0 0
```
Now take the rowwise sum `&(+/)` of each, which results in:
```
1 1 1 1 1  NB. right tine
1 3 2 2 3  NB. left tine
```
In the right tine (meal), the number at index `i` is the count of meal letter `i` within meal (all 1 in this example because the letters are unique).
In the left tine (ingredients), the number at index `i` is the count of meal letter `i` within ingredients.
We divide those elementwise `1 3 2 2 3 % 1 1 1 1 1` = `1 3 2 2 3`, rounding down `<.@` each element to handle fractional amounts (not relevant in this example).
Finally we take the min `<./@` of the whole result, which in this case is `1`. This reflects the constraint of having a single `b` in our ingredients, limiting the number of meals we can make to 1.
[Answer]
# [Java (JDK)](http://jdk.java.net/), 94 bytes
```
a->s->{var z=new int[91];for(var c:a)z[c]++;for(;;z[0]++)for(var c:s)if(z[c]--<1)return z[0];}
```
[Try it online!](https://tio.run/##nVJRi9pAEH6/XzEIlqS3CfWxl1MoB4U@9Onok/iwJpu4NtkNMxNFxd9uZ43eiae0lJBdZub75vsSvqVe6WRZ/D7YpvXIsJQ67djW6efs4UOv7FzO1rswzGtNBD@1dbB7AGi7eW1zINYs18rbAhqZRa@M1lXTGWisKD5CAb6f9jznC43Tmbqu4YdjUxmcTKCE8UEnE0omu5VG2I6dWYN1PP06mmWlxyh08ycdb6f57PHx2Mqy7fSLFPH7nGJbRgGSJM@jGA136CCgsv0hO3o6GxWrbIgJxiezADsYzHXunbpzDtQJMIC9uuQ4eVTuZdLxHVC/pV/V7@uX3oGzbzR75dFU2nnV2u1WFBYiUWs2d0jEqNdzg2gNqdJW9M5QpLGwzlCg5r4oLS2uFBeGjNIoUN8YhdoVvlFrjwXJuQ48j1d6AdiIR1UYCYX1HSn5t2gKaxyTWhjsrfraV6JtbtDvM49eJGxEf9sx951jW3a1/NEqXL78v20hECocAcP8Ntz30TnHLCCe@vTEb@EJgwtRiVUASPJS9r/a1uCLJhPFUr1I@L8h6k0UZxfkxuj6zBr9E@t1Q2ya1HecthJqLqPBkOATyJFMYFgMQ2JvulC3ZRSUqW7behNdfEl8agV/8Ul7/xDe/eEP "Java (JDK) – Try It Online")
Both inputs are uppercase letters to save a byte. If not allowed, please tell me, I'll fix it and add the byte.
## Credits
* Kevin Cruijssen for tidying up the inputs
[Answer]
# JavaScript (ES6), ~~59 ... 51~~ 50 bytes
Takes input as `(ingredients)(meal)`, where *ingredients* is the list of ingredients as a comma-separated string and *meal* is a list of characters. All names are expected in upper case.
Returns *false* [instead of 0](https://codegolf.meta.stackexchange.com/a/9067/58563).
```
s=>g=m=>m.every(c=>s<(s=s.replace(c))|++c)&&1+g(m)
```
[Try it online!](https://tio.run/##jdHRasIwFAbg@z2FVzbFrM7N3a1C2h7bQJtIEhEcu5CuyoZasUMY7N271KCT1jIbOBCSfvx/@7k4LIp0/7H7ut/m71m5dMvCHa3cjTvaONkh23@j1B0VL6hwC2ef7daLNEOpbf/0eqnd7Q56K7SxyzTfFvk6c9b5Ci2RJSckwbXhEZ8zDGEozTD76siy0avjOJYHhEnrzbY7/X7n8a5mmvst80wcNxXReLT53DSZXtjn@q2pugFpmoO6aUKZZCaeyXirrs1h3VQ8IYpjLiAkjOMJnc916kjHjomC/2VtPtRNqQSZeSAEBYnHVP@RM4glEQFlIE@yz4POmMroEr/WXUUgAROhBZ4AFoQFPMEzLgKp5@zEcdHSX5tPjZyVlOjqOICY@pRPJaYsFBBQYEriCMTfF@AxD3VuuPCvdq/Mdu7YwIuplC1w1b38BQ "JavaScript (Node.js) – Try It Online")
### Commented
```
s =>                   // s = list of ingredients
  g = m =>             // g is a recursive function taking m[] = meal,
                       // as a list of characters
    m.every(c =>       // for each character c in m[]:
      s < (            //   test whether s is less than ...
        s =            //     ... the updated value of s where ...
          s.replace(c) //       ... the 1st occurrence of c is replaced with 'undefined'
      )                //   end of comparison (falsy if c was not found)
      | ++c            //   force a truthy result if c is a space
    ) &&               // end of every(); if successful:
      1 + g(m)         //   increment the final result and do a recursive call
```
[Answer]
# [APL (Dyalog Extended)](https://github.com/abrudz/dyalog-apl-extended), 15 bytes
```
⌊⌂dab⍛(⌊/⍧÷⊣⍧⊣)
```
[Try it online!](https://tio.run/##NU0xTgMxEOx5xXaGIqLgCTSkQiJ8YH3eu7Pk80a2o4SUiZTilIugoKKkoKSkh5/sR469IFaaGY00O4PLMHNPGLiZ0aZQdOTGUY69HHcOrQxvl2quZfj4@ZL@XVX5aqzl8CzDSU6v83vp99@fN3J4Ubd4uFV@vJsvRmNZSyNlgv8zUIPJ3BFYXsXi61UAi80kXIOPTSLnKZYMLSUCVNjgczYXxmLF8fxfuMPCwIkajAxLv90iVC1XHLCQRjn95dppeuo4LyaMjjtYc3JZeW1@AQ "APL (Dyalog Extended) – Try It Online")
A dyadic train which takes the meal as its left arg and space-separated ingredients as right arg. (Comma-separated ingredients should work equally well.)
### How it works
```
⌊⌂dab⍛(⌊/⍧÷⊣⍧⊣)  ⍝ Left: meal, Right: ingredients
 ⌂dab⍛(       )  ⍝ Remove all spaces from the meal
         ⍧       ⍝ Counts of each char of meal in the ingredients
          ÷      ⍝ Divided by
           ⊣⍧⊣   ⍝ Counts of each char of meal in the meal
       ⌊/        ⍝ Minimum
⌊                ⍝ Floor (the result of division might be fractional)
```
Without the space-handling requirement, the code would be **9 bytes**:
```
⌊/⍤⌊⍧÷⊣⍧⊣
```
[Try it online!](https://tio.run/##JY0xbgIxEEV7TjGdK0SRI9CEKhLkAuP17K4lrwfZRhDaSBSrLEqKnCCRKCnpyU3mIpvJppj/9KU//@M2zN0LBm7mdCgUHblxlLd@IcO3QobLz036L6XqWMvpXYaznD9XT9K/3q8PcvpQt1kvVZ8fV5vRWNaySJkM1GAydwSWd7H4ehfAYvMHrsHHJpHzFEuGlhIB6tngczYzY7HiOP0X7rAwcKIGI8PWH48IVcsVByykUU7/uVYXp45pMWF03MGek8uqe/ML "APL (Dyalog Extended) – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~10~~ 9 bytes
*-1 byte thanks to Kevin Cruijssen*
```
Jsθáδ¢`÷ß
```
[Try it online!](https://tio.run/##yy9OTMpM/f/fq/jcjsMLz205tCjh8PbD8///j45WKi4pSixPSi0qykwtVtJRUErLTAfTyRn5yfk5iSWpIE5xYlFKZh5QQayOQrRSMkgoH0SkgAgFsDYQkQlWCyIylGJjAQ "05AB1E – Try It Online") or [validate all test cases](https://tio.run/##lY9BTsQwDEX3nCLquuxZMTsWXGE0Em5jWkttjJyMKs0p5gYIzoAEa7qfK5XEYTLApkKVfn8S@32bPTSEy83dfNxU5vrWVJvl3p8@5pfT2@frw/w@Py/1st1WDbTsqtqsm11tYnk6Q5I2CSeJT7srRbn46RvHhn1YbykJJakkluR1SuARgt6wYAdO7RMdDrm@j9MMEHAd5IPA1KAIoU/3j9T534h48CCWXCxQ3AVikxhtS0Jam6Q/j9mjVwJIBvGofwFneUxuYrE@mynjlSzn8b4bRs4AiwO1xHttIdcJWkIXcijKz4WVMxTX5a2jYBkT/6Ss0i@bNAN5//@0Lw).
Takes the ingredients as a list of strings, and the meal as a list of characters.
```
J                  # join each input
 sθ                # get the last input (meal)
   á               # keep only letters
    δ¢             # double-vectorized count occurences
      `            # dump to the stack
       ÷           # integer division
        ß          # minimum
```
[Answer]
# [C# (Visual C# Interactive Compiler)](http://www.mono-project.com/docs/about-mono/releases/5.0.0/#csc), ~~54~~ ~~63~~ 60 bytes
```
s=>t=>t.Min(x=>x>32?s?.Count(c=>c==x)/t.Count(c=>c==x):null)
```
`Min` can calculate the minimum selectively if `int?` objects are used. To obtain such objects, I use the `?.` operator: `s` will never be `null`, but it casts `int` to `int?` for 1 byte anyway.
[Try it online!](https://tio.run/##bY7BCsIwDIbvPkXZaQWdoDe13UHYTfAVuqxzhS2BpGN7@7mpByeSn0Dy/18IyA4kTEWPcJHIAR9btRoCxtxaVSijJjE2zspuAdPR2NEeD7nk2ZV6jCkYC8aMeh9/Fifs21ZP5819vhjTIk1KB4T/WqI/ZqL1V37@xQ2lZw5e6vAQaAioddGL4yqgl4UDqlQdpFmjsfHiHXuhzrPDirqBuJKBhoUhXqeJl3o76qXFn54 "C# (Visual C# Interactive Compiler) – Try It Online")
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 48 bytes
```
 
%O`.
L$`\G((.)\2*)(?=.*¶.*?(\1)+)?
$#3
N`
1G`
```
[Try it online!](https://tio.run/##dY1BasQwDEX3PoWgM@CkJpB2XbKcTWkX3WZhJ1YTQ2INkofAHKwH6MVSk0wpFAbBB/3/pM@YQnT1etQf1qyg1PHdVur1YNuT1lXRPpWFbl6q8vurKhvd1sVj0ajDw7N6s6o@2XXtXE/RbAp3VP0yMQ/0lJdLupk7taM7vx/d4kSzSwTEOLhIcA7Xa/4w5heTS6h68vAZZDSS2C0dMgeU7AzyB4E49iGiKGKTRhQEx9mlGYFd9DTDQuwl66I6mmjILJotn3MxeJxCH@giEOLA6APGJDAi43/8PrlVdlMQ@QE "Retina – Try It Online") Link includes test suite. Takes input as dish on the first line and space-separated ingredients on the second line but the test suite uses a more convenient comma separator. Explanation:
```
 
```
Delete spaces in the dish and ingredients.
```
%O`.
```
Separately sort the letters in the dish and ingredients.
```
L$`\G((.)\2*)(?=.*¶.*?(\1)+)?
$#3
```
For each distinct letter in the dish, count the number of times its appearance in the dish divides into its appearance in the ingredients.
```
N`
```
Sort the counts.
```
1G`
```
Take the minimum.
[Answer]
# [Perl 5](https://www.perl.org/) `-nlF`, ~~54~~ ~~47~~ 39 bytes
*Shoutout to @Grimmy for helping me fix an issue with no net gain of bytes*
```
$_=<>;$j++while s/$F[$j%@F]//x;say$j/@F
```
[Try it online!](https://tio.run/##K0gtyjH9/18l3tbGzlolS1u7PCMzJ1WhWF/FLVolS9XBLVZfv8K6OLFSJUvfwe3//6TE5HyFvHyuaHUQC4jz8tVj/@UXlGTm5xX/1/U11TMwNPivm5fjBuRk5pWkpqcWAQA "Perl 5 – Try It Online")
First line of input is the recipe; second line contains the ingredients (doesn't matter how or if they're separated).
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), 16 bytes
```
hSmL//hQd/eQdsce
```
[Try it online!](https://tio.run/##K6gsyfj/PyM410dfPyMwRT81MKU4OfX/f/WSjNTiVJ3EolSd4vzcVJ2ixLyU/Fyd8vyilGIgWa6uo6Cer1CkDgA "Pyth – Try It Online")
### Explanation
```
hSmL//hQd/eQdsce(Q)
                (Q)  : Implicit evaluated input
               e     : Get last element of input
              c      : Split string at spaces
             s       : Concatenate split strings
   L                 : Lambda with argument named d
       Q             : Evaluated input
      h              : Get first element of input
     /  d            : Count occurrences of d in first element of input
           Q         : Evaluated input
          e          : Get last element of input
         /  d        : Count occurrences of d in last element of input
    /                : Divided occurrences of d in first element of input by occurrences of d in last element of input
  m                  : Map the lambda over last element of input
 S                   : Sort the result of the map
h                    : Get the first element from result of sort
```
[Answer]
# C (gcc), ~~135~~ 133 bytes
Expects ingredients and request as command line arguments (the last one is the request). The return value of the program is the result.
```
l[128],n;char*a;main(c,v)char**v;{for(++v;c---2;)for(a=*v++;*a;++l[*a++]);for(a=*v,n=l[*a];*a;++a)n=*a-32&&l[*a]<n?l[*a]:n;return n;}
```
[Answer]
# [Python 3](https://docs.python.org/3/), ~~117~~ \$\cdots\$ ~~103~~ 70 bytes
Saved a whopping 33 bytes thanks to [Surculose Sputum](https://codegolf.stackexchange.com/users/92237/surculose-sputum)!!! 
```
f=lambda l,m:all(e in l and[l.remove(e)]for e in m if' '<e)and-~f(l,m)
```
[Try it online!](https://tio.run/##hZLBTuMwEIbvfYoRlzirgGDLCqkiHHkCbiUHt5k0g2xPNXaoIMq@etdxu9mUPRAf8jv@/2880ew/QstueTw2pdF2U2swhV1pYxQCOTCgXb02N4KW31FhXjUskI4sUJNB9oh5tFz/blQM5seAPngoQS0gPkqts43esssK@F5Uk8oL@JUXM4SLazRuOR534dJ6N7NOxIk8VZgqXabvZ@nAVgcefSy40y7JPX1@noq3sbrRAS8BtzOAD6IPGxQh9GOkoZ2/jMaN11KTi4YqdVRDQ7792kho0Se3llOIbXpL/NtsR3Vgqf1JHBKKZYQs59c5hyyfIDUa2hJ3KUZuJ1gTupC2Lcq5MTa8c2P1r82dad9S/t16Y8j7/6l/G80XEmelf5EOV9Blr93Ph7tlzD1r46cv99tsWIxjF4o0eGnEVilPhY35kLQvG7X@kWU3b0xOUV7FcUwHeyEXVHPV01D0doDrJ@j9AL2sfVliNVzli@Mf "Python 3 – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 17 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
kS £V¬èX zU¬èXÃrm
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=a1Mgo1as6FggelWs6FjDcm0&input=WyJiIiwibyIsImwiLCJvIiwiZyIsIiAiLCJuIiwiZSIsInMiLCJlIl0KWydzb21lJywgJ2JvdW50aWZ1bCcsICdiYWdmdWwnLCAnb2YnLCAnaW5ncmVkaWVudHMnLCAnaGVyZScsICdhcmUnLCAnYmxpc3MnXSA)
[Answer]
# [JavaScript (V8)](https://v8.dev/), 136 bytes
```
(a,b)=>{b=b.filter(a=>" "!==a),c=-1,d=!1;do c++,d=!0,b.forEach(b=>-1==(i=a.indexOf(b))?d=!1:a.splice(i,1)),c=d?c:c--;while(d);return c};
```
## Input:
* Ingredients: array of characters
* Meal: array of characters
Original commented code (`a=ingredients, b=meal, c=meals, d=yes`):
```
f = (ingredients, meal) => { // es6 arrow function syntax
    meal = meal.filter(i => i !== ' '); // delete all the spaces
    meals = -1 // set number of meals to -1, since we'll be adding one later on
    yes = false // yes is whether there are any meals left to make
    do { // do...while instead of while so it runs at least once
        meals++; // increment meals
        yes = true; // yes there is a meal to make
        meal.forEach(v => { // es6 arrow function for each character of the meal
            return (i = ingredients.indexOf(v)) == -1 ? // ternary operator, set i to index of character in ingredients, then check if its -1
                yes = false // if it is we can't find the character, so we can't make a meal
                    : ingredients.splice(i, 1) // we take out the letter from the ingredients list
        });
        meals = // assign to meals
            yes ? // ternary operator, check if we made a meal
                meals : meals-- // if we didn't make a meal then decrement meals
    } while (yes) // repeat if we made a meal
    return meals; // return the number of meals
}
```
Methods mentioned:
* [arrow function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions)
* [ternary operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator)
* [do...while](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/do...while)
[Try it online!](https://tio.run/##tVJLbsIwFNz3FIENtkiiZlcRGVZd9wAVC8d2PlWwkR1I1apnT214bk0KKkjtYuT4/WbeOC90Tw3TzbZL9g9DSQZE4wKT5XtBirRs2k5oRMlyGk0nhFAcM5JkMSeTLOcqYvO5@76PbanSj5TVqCDLJCMENYSmjeTi9alEBcYr17Kgqdm2DROoiTPsZvEVW7Akyfu6aQXiONei22kZsY98YEoa1Yq0VRUq0fOsmMUzasEslIW0@NvYOo7O0awxzu8uqZGj07eFTDuL7qbp57Se035ul5@73cLcQXoD5f7uoC2ERRXs7OJbi8biDeBp6pEXbTBT3KTKQJeG8h52FBDToMDdXW0J9wruv6s51lGYxaFffuUOan2rS0cBjTmMv@hnHTCIgMXHvN8i2FACjc/1wRtw6POx/qjumL7oX8iyGb0oh7OFhRicCv5eE/hRjfq87xK8NMHG@vSlve0KxsgTY65S/r9KT9@mCHjM919w3SbDJw "JavaScript (V8) – Try It Online")
[Answer]
# [Erlang (escript)](http://erlang.org/doc/man/escript.html), 81 bytes
To fix the bug I had to switch to filtering.
```
f(I,M)->lists:min([length([X||X<-I,X==C])div length([X||X<-M,X==C])||C<-M,32<C]).
```
[Try it online!](https://tio.run/##jYwxC4MwEIV3f4U4JXA6tJuoSycHd0EcUhs1EBNJri2I/z09oUNLl97Bce/eu086LcyUSj84tWKIwshqaHhaaeXR54syrNPSTDizrt33tkhraMvy0vObesTfTvN29v1yiPOpIJGFRRyQnsdpFcVUyuZPp1CykSVXYahhsIM1d0yADrQlnAOljGYcfl7QLgItWCcnYSysatsIMBNBC5T/IaRHOAalET@iWXgB "Erlang (escript) – Try It Online")
## Explanation
```
f(I,M)->       % Function with operands I and M
lists:min(     % Find the minimum of this list.
[length(       % Find the length of:
[X||X<-I,X==C] % I items only containing C
)div           % Integer-divided by
length(        % the length of
[X||X<-M,X==C] % M items only containing C
)||C<-M,       %Ｗｈｅｒｅ　ｔｈｅ　ｉｔｅｍ　ｉｓ　ｔａｋｅｎ　ｆｒｏｍ　Ｍ
32<C]          % and the current item is larger than the space
).
```
[Answer]
# [MS SQL Server 2017](https://docs.microsoft.com/en-us/sql/sql-server/sql-server-technical-documentation?view=sql-server-2017), 300 bytes
```
CREATE FUNCTION F(@ NVARCHAR(MAX),@R NVARCHAR(MAX))RETURNS
TABLE RETURN WITH A AS(SELECT LEFT(@R,1)C,STUFF(@R,1,1,'')R
UNION ALL SELECT LEFT(R,1),STUFF(R,1,1,'')FROM A
WHERE R!=''),B AS(SELECT(LEN(@)-LEN(REPLACE(@,C,'')))/COUNT(*)OVER(PARTITION BY C)R
FROM A WHERE C LIKE'[A-Z]')SELECT MIN(R)R FROM B;
```
Try it on [db<>fiddle](https://dbfiddle.uk/?rdbms=sqlserver_2017l&fiddle=430c11e47063451feba4b5440a14af39).
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 15 bytes
```
Ｉ⌊ＥΦη№βι÷№θι№ηι
```
[Try it online!](https://tio.run/##NcpNCsIwEIbhvaeYZQrxBC4rgouCV8jP0AwkM5pJev20Vfzg27w8IbkaxOUxXpW4mdlpMwsxlV7M4t7mQblhNcnCLP0A3gJNk4UntzttFNH8@ufsf5S@6NxtDJWCEDFTIOkKxGvFSMhNIWFFcMd9JtWLlywro@K4bnkH "Charcoal – Try It Online") Link is to verbose version of code. Takes input as a space-separated list of ingredients on the first line and the dish on the second line. Explanation:
```
    η           Second input (dish)
   Φ            Filter over characters
     №          Count of
       ι        Current character
      β         In lowercase alphabet
  Ｅ             Map over characters
         №      Count of
           ι    Current character
          θ     In ingredients
        ÷       Integer divide by
            №   Count of
              ι Current character
             η  In dish
 ⌊              Take the minimum
Ｉ               Cast to string
                Implicitly print
```
]