시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 90 40 38 54.286%

문제

단어 사다리란 퍼즐의 한 종류인데, 두 단어가 주어지면 한 단어에서 한 글자씩 바꿔서 다른 단어를 만드는 것이다. 이 게임은 좋은 어휘력과 맞춤법이 필요하다. 그래서 정답인지 아닌지 확인하는 게 너무 지루하고 귀찮다. 

한 쌍의 단어가 단어 사다리가 되는 조건은 다음과 같다:

  • 단어의 길이가 같고
  • 반드시 한 글자씩 바뀌어야한다.

단어 사다리가 가능한 지 판별하는 프로그램을 작성하시오.

입력

입력이 여러번 주어지는데, #이 입력되기 전까지를 하나의 테스트케이스로 간주한다.

각 테스트케이스는 3자 이상 20자 이하의 대문자 알파벳으로 된 단어들이 순서대로 입력된다. 입력의 마지막 줄에는 #이 주어진다.

출력

단어 사다리가 가능하다면 'Correct'를, 아니면 'Incorrect'를 출력한다.

예제 입력 1

BARK
BARE
#
BEAK
BRAK
BRAD
BEAD
#
BEAK
BEAD
BEND
LEND
LAND
LANE
LAKE
#
MAKE
BAKE
BONK
BONE
BANE
#
#

예제 출력 1

Correct
Correct
Correct
Incorrect

힌트

W3sicHJvYmxlbV9pZCI6IjkyMjkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWIyZThcdWM1YjQgXHVjMGFjXHViMmU0XHViOWFjIiwiZGVzY3JpcHRpb24iOiI8cD5cdWIyZThcdWM1YjQgXHVjMGFjXHViMmU0XHViOWFjXHViNzgwIFx1ZDM3Y1x1Yzk5MFx1Yzc1OCBcdWQ1NWMgXHVjODg1XHViOTU4XHVjNzc4XHViMzcwLCBcdWI0NTAgXHViMmU4XHVjNWI0XHVhYzAwIFx1YzhmY1x1YzViNFx1YzljMFx1YmE3NCBcdWQ1NWMgXHViMmU4XHVjNWI0XHVjNWQwXHVjMTFjJm5ic3A7XHVkNTVjIFx1YWUwMFx1Yzc5MFx1YzUyOSBcdWJjMTRcdWFmZDRcdWMxMWMgXHViMmU0XHViOTc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