codeforces-scrape

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

928A.md (2748B)


      1 Source: https://codeforces.com/problemset/problem/928/A
      2 
      3 A. Login Verification
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 When registering in a social network, users are allowed to create their own convenient login to make it easier to share contacts, print it on business cards, etc.
     22 
     23 Login is an arbitrary sequence of lower and uppercase latin letters, digits and underline symbols («_»). However, in order to decrease the number of frauds and user-inattention related issues, it is prohibited to register a login if it is similar with an already existing login. More precisely, two logins *s* and *t* are considered similar if we can transform *s* to *t* via a sequence of operations of the following types:
     24 
     25 * transform lowercase letters to uppercase and vice versa;
     26 * change letter «O» (uppercase latin letter) to digit «0» and vice versa;
     27 * change digit «1» (one) to any letter among «l» (lowercase latin «L»), «I» (uppercase latin «i») and vice versa, or change one of these letters to other.
     28 
     29 For example, logins «Codeforces» and «codef0rces» as well as «OO0OOO00O0OOO0O00OOO0OO_lol» and «OO0OOO0O00OOO0O00OO0OOO_1oI» are considered similar whereas «Codeforces» and «Code_forces» are not.
     30 
     31 You're given a list of existing logins with no two similar amonst and a newly created user login. Check whether this new login is similar with any of the existing ones.
     32 
     33 Input
     34 
     35 The first line contains a non-empty string *s* consisting of lower and uppercase latin letters, digits and underline symbols («_») with length not exceeding 50  — the login itself.
     36 
     37 The second line contains a single integer *n* (1 ≤ *n* ≤ 1 000) — the number of existing logins.
     38 
     39 The next *n* lines describe the existing logins, following the same constraints as the user login (refer to the first line of the input). It's guaranteed that no two existing logins are similar.
     40 
     41 Output
     42 
     43 Print «Yes» (without quotes), if user can register via this login, i.e. none of the existing logins is similar with it.
     44 
     45 Otherwise print «No» (without quotes).
     46 
     47 Examples
     48 
     49 Input
     50 
     51 ```
     52 1_wat  
     53 2  
     54 2_wat  
     55 wat_1
     56 ```
     57 
     58 Output
     59 
     60 ```
     61 Yes
     62 ```
     63 
     64 Input
     65 
     66 ```
     67 000  
     68 3  
     69 00  
     70 ooA  
     71 oOo
     72 ```
     73 
     74 Output
     75 
     76 ```
     77 No
     78 ```
     79 
     80 Input
     81 
     82 ```
     83 _i_  
     84 3  
     85 __i_  
     86 _1_  
     87 I
     88 ```
     89 
     90 Output
     91 
     92 ```
     93 No
     94 ```
     95 
     96 Input
     97 
     98 ```
     99 La0  
    100 3  
    101 2a0  
    102 La1  
    103 1a0
    104 ```
    105 
    106 Output
    107 
    108 ```
    109 No
    110 ```
    111 
    112 Input
    113 
    114 ```
    115 abc  
    116 1  
    117 aBc
    118 ```
    119 
    120 Output
    121 
    122 ```
    123 No
    124 ```
    125 
    126 Input
    127 
    128 ```
    129 0Lil  
    130 2  
    131 LIL0  
    132 0Ril
    133 ```
    134 
    135 Output
    136 
    137 ```
    138 Yes
    139 ```
    140 
    141 Note
    142 
    143 In the second sample case the user wants to create a login consisting of three zeros. It's impossible due to collision with the third among the existing.
    144 
    145 In the third sample case the new login is similar with the second one.