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

6407번 - String Computer 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB73360.000%

문제

Extel have just brought out their newest computer, a string processing computer dubbed the X9091. It is hoped that it will have some value in cryptography and related fields. (It is rumoured that the Taiwanese are working on a clone that will correct Stage 1 essays, but we will ignore such vapourware). This computer will accept input strings and produce output strings from them, depending on the programs loaded into them at the time. The chip is the ultimate in RISC technology---it has only three transformation instructions:

  • Delete a character at a particular position.
  • Insert a character at a particular position.
  • Change the character at a particular position to a different character.

Programs for this machine are written in a form of machine code where each instruction has the format ZXdd---Z represents the code for the instruction (D, I or C), X is a character and dd represents a two digit number. A program is terminated by a special halt instruction consisting of the letter 'E'. Note that each instruction works on the string in memory at the time the instruction is executed.

To see how this all works consider the following example. It is desired to transform the string 'abcde' to the string 'bcgfe'. This could be achieved by a series of Change commands, but is not minimal. The following program is better.

 abcde
Da01 bcde % note the ‘a’ is necessary because it is checked by the hardware
Cg03 bcge
If04 bcgfe
E bcgfe % Terminates the program

Write a program that will read in two strings (the input string and the target string) and will produce a minimal X9091 program necessary to transform the input string into the target string. Since there may be multiple solutions, only one should be produced. Any solution that satisfies these criteria will be accepted.

입력

Input will consist of a series of lines, each line containing two strings separated by exactly one space. The strings will consist of no more than 20 lower case characters. The file will be terminated by a line consisting of a single #.

출력

Output will consist of a series of lines, one for each line of the input. Each will consist of a program in X9091 language.

제한

예제 입력 1

abcde bcgfe
#

예제 출력 1

Da01Cg03If04E

힌트

출처

ICPC > Regionals > South Pacific > South Pacific Region > 1991 ACM South Pacific Programming Contest A번

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

출처

대학교 대회

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

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