시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 117 52 50 56.180%

문제

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

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

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

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

입력

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

각 테스트케이스는 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
W3sicHJvYmxlbV9pZCI6IjkyMjkiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWIyZThcdWM1YjQgXHVjMGFjXHViMmU0XHViOWFjIiwiZGVzY3JpcHRpb24iOiI8cD5cdWIyZThcdWM1YjQgXHVjMGFjXHViMmU0XHViOWFjXHViNzgwIFx1ZDM3Y1x1Yzk5MFx1Yzc1OCBcdWQ1NWMgXHVjODg1XHViOTU4XHVjNzc4XHViMzcwLCBcdWI0NTAgXHViMmU4XHVjNWI0XHVhYzAwIFx1YzhmY1x1YzViNFx1YzljMFx1YmE3NCBcdWQ1NWMgXHViMmU4XHVjNWI0XHVjNWQwXHVjMTFjJm5ic3A7XHVkNTVjIFx1YWUwMFx1Yzc5MFx1YzUyOSBcdWJjMTRcdWFmZDRcdWMxMWMgXHViMmU0XHViOTc4IF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