codeforces-scrape

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

946C.md (1357B)


      1 Source: https://codeforces.com/problemset/problem/946/C
      2 
      3 C. String Transformation
      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 You are given a string *s* consisting of |*s*| small english letters.
     22 
     23 In one move you can replace any character of this string to the next character in alphabetical order (a will be replaced with b, s will be replaced with t, etc.). You cannot replace letter z with any other letter.
     24 
     25 Your target is to make some number of moves (not necessary minimal) to get string abcdefghijklmnopqrstuvwxyz (english alphabet) as a subsequence. Subsequence of the string is the string that is obtained by deleting characters at some positions. You need to print the string that will be obtained from the given string and will be contain english alphabet as a subsequence or say that it is impossible.
     26 
     27 Input
     28 
     29 The only one line of the input consisting of the string *s* consisting of |*s*| (1 ≤ |*s*| ≤ 105) small english letters.
     30 
     31 Output
     32 
     33 If you can get a string that can be obtained from the given string and will contain english alphabet as a subsequence, print it. Otherwise print «-1» (without quotes).
     34 
     35 Examples
     36 
     37 Input
     38 
     39 ```
     40 aacceeggiikkmmooqqssuuwwyy
     41 ```
     42 
     43 Output
     44 
     45 ```
     46 abcdefghijklmnopqrstuvwxyz
     47 ```
     48 
     49 Input
     50 
     51 ```
     52 thereisnoanswer
     53 ```
     54 
     55 Output
     56 
     57 ```
     58 -1
     59 ```