codeforces-scrape

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

31B.md (1692B)


      1 Source: https://codeforces.com/problemset/problem/31/B
      2 
      3 B. Sysadmin Bob
      4 
      5 time limit per test
      6 
      7 0.5 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Email address in Berland is a string of the form *A*@*B*, where *A* and *B* are arbitrary strings consisting of small Latin letters.
     22 
     23 Bob is a system administrator in «Bersoft» company. He keeps a list of email addresses of the company's staff. This list is as a large string, where all addresses are written in arbitrary order, separated by commas. The same address can be written more than once.
     24 
     25 Suddenly, because of unknown reasons, all commas in Bob's list disappeared. Now Bob has a string, where all addresses are written one after another without any separators, and there is impossible to determine, where the boundaries between addresses are. Unfortunately, on the same day his chief asked him to bring the initial list of addresses. Now Bob wants to disjoin addresses in some valid way. Help him to do that.
     26 
     27 Input
     28 
     29 The first line contains the list of addresses without separators. The length of this string is between 1 and 200, inclusive. The string consists only from small Latin letters and characters «@».
     30 
     31 Output
     32 
     33 If there is no list of the valid (according to the Berland rules) email addresses such that after removing all commas it coincides with the given string, output No solution. In the other case, output the list. The same address can be written in this list more than once. If there are several solutions, output any of them.
     34 
     35 Examples
     36 
     37 Input
     38 
     39 ```
     40 a@aa@a
     41 ```
     42 
     43 Output
     44 
     45 ```
     46 a@a,a@a
     47 ```
     48 
     49 Input
     50 
     51 ```
     52 a@a@a
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 No solution
     59 ```
     60 
     61 Input
     62 
     63 ```
     64 @aa@a
     65 ```
     66 
     67 Output
     68 
     69 ```
     70 No solution
     71 ```