Logo
(追記) (追記ここまで)

10236번 - Encryption System 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB41101024.390%

문제

A programmer developed a new encryption system. However, his system has an issue that two or more distinct strings are 'encrypted' to the same string.

We have a string encrypted by his system. To decode the original string, we want to enumerate all the candidates of the string before the encryption. Your mission is to write a program for this task.

The encryption is performed taking the following steps. Given a string that consists only of lowercase letters ('a' to 'z').

  1. Change the first 'b' to 'a'. If there is no 'b', do nothing.
  2. Change the first 'c' to 'b'. If there is no 'c', do nothing.
  3. ...
  4. Change the first 'z' to 'y'. If there is no 'z', do nothing.

입력

The input consists of at most 100 datasets. Each dataset is a line containing an encrypted string. The encrypted string consists only of lowercase letters, and contains at least 1 and at most 20 characters.

The input ends with a line with a single '#' symbol.

출력

For each dataset, the number of candidates n of the string before encryption should be printed in a line first, followed by lines each containing a candidate of the string before encryption. If n does not exceed 10, print all candidates in dictionary order; otherwise, print the first five and the last five candidates in dictionary order.

Here, dictionary order is recursively defined as follows. The empty string comes the first in dictionary order. For two nonempty strings x = x1 ... xk and y = y1 ... yl, the string x precedes the string y in dictionary order if

  • x1 precedes y1 in alphabetical order ('a' to 'z'), or
  • x1 and y1 are the same character and x2 ... xk precedes y2 ... yl in dictionary order.

제한

예제 입력 1

enw
abc
abcdefghijklmnopqrst
z
#

예제 출력 1

1
fox
5
acc
acd
bbd
bcc
bcd
17711
acceeggiikkmmooqqssu
acceeggiikkmmooqqstt
acceeggiikkmmooqqstu
acceeggiikkmmooqrrtt
acceeggiikkmmooqrrtu
bcdefghijklmnopqrrtt
bcdefghijklmnopqrrtu
bcdefghijklmnopqrssu
bcdefghijklmnopqrstt
bcdefghijklmnopqrstu
0

힌트

출처

ICPC > Regionals > Asia Pacific > Japan > Japan Domestic Contest > 2014 Japan Domestic Contest D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /