codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

43B.md (1473B)


      1 Source: https://codeforces.com/problemset/problem/43/B
      2 
      3 B. Letter
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Vasya decided to write an anonymous letter cutting the letters out of a newspaper heading. He knows heading *s*1 and text *s*2 that he wants to send. Vasya can use every single heading letter no more than once. Vasya doesn't have to cut the spaces out of the heading — he just leaves some blank space to mark them. Help him; find out if he will manage to compose the needed text.
     22 
     23 Input
     24 
     25 The first line contains a newspaper heading *s*1. The second line contains the letter text *s*2. *s*1 и *s*2 are non-empty lines consisting of spaces, uppercase and lowercase Latin letters, whose lengths do not exceed 200 symbols. The uppercase and lowercase letters should be differentiated. Vasya does not cut spaces out of the heading.
     26 
     27 Output
     28 
     29 If Vasya can write the given anonymous letter, print YES, otherwise print NO
     30 
     31 Examples
     32 
     33 Input
     34 
     35 ```
     36 Instead of dogging Your footsteps it disappears but you dont notice anything  
     37 where is your dog
     38 ```
     39 
     40 Output
     41 
     42 ```
     43 NO
     44 ```
     45 
     46 Input
     47 
     48 ```
     49 Instead of dogging Your footsteps it disappears but you dont notice anything  
     50 Your dog is upstears
     51 ```
     52 
     53 Output
     54 
     55 ```
     56 YES
     57 ```
     58 
     59 Input
     60 
     61 ```
     62 Instead of dogging your footsteps it disappears but you dont notice anything  
     63 Your dog is upstears
     64 ```
     65 
     66 Output
     67 
     68 ```
     69 NO
     70 ```
     71 
     72 Input
     73 
     74 ```
     75 abcdefg hijk  
     76 k j i h g f e d c b a
     77 ```
     78 
     79 Output
     80 
     81 ```
     82 YES
     83 ```