배경
그만큼 버로우즈 - 휠러 변환 (BWT) 캐릭터 라인의 문자 가역 순열가되도록 일반 텍스트로 문자열의 특정 유형의 유사 문자의 큰 실행 결과. 예를 들어 bzip2 압축 알고리즘에서 사용 됩니다.
BWT는 다음과 같이 정의됩니다.
와 같은 입력 문자열이 주어지면 codegolf
가능한 모든 회전을 계산하고 사전 순서대로 정렬하십시오.
codegolf
degolfco
egolfcod
fcodegol
golfcode
lfcodego
odegolfc
olfcodeg
문자열의 BWT는 codegolf
각 문자열의 마지막 문자, 즉 위의 블록의 마지막 열로 구성된 문자열입니다. 에 대한codegolf
에 대해이 결과는 과 같습니다 fodleocg
.
그 자체로,이 변환은 문자열 codegolf
과golfcode
결과가 동일한 문자열 . 그러나 문자열이로 끝나는 것을 알고 있으면 f
가능한 사전 이미지가 하나뿐입니다.
직무
STDIN에서 단일 문자열을 읽거나 명령 행 또는 함수 인수로 사용하여 BWT 또는 입력 문자열의 역수를 인쇄하거나 리턴하는 복잡한 프로그램 또는 함수를 구현하십시오.
입력 문자열에 공백이 없으면 제출물이 단일 공백을 입력에 추가하고 BWT를 계산해야합니다.
입력 문자열에 이미 공백이 있으면 후행 공백이있는 BWT의 사전 이미지를 계산하고 해당 공백을 제거해야합니다.
예
INPUT: ProgrammingPuzzles&CodeGolf
OUTPUT: fs&e grodllnomzomaiCrGgPePzu
INPUT: fs&e grodllnomzomaiCrGgPePzu
OUTPUT: ProgrammingPuzzles&CodeGolf
INPUT: bt4{2UK<({ZyJ>LqQQDL6!d,@:~L"#Da\6%EYp%y_{ed2GNmF"1<PkB3tFbyk@u0#^UZ<52-@bw@n%m5xge2w0HeoM#4zaT:OrI1I<|f#jy`V9tGZA5su*b7X:Xn%L|9MX@\2W_NwQ^)2Yc*1b7W<^iY2i2Kr[mB;,c>^}Z]>kT6_c(4}hIJAR~x^HW?l1+^5\VW'\)`h{6:TZ)^#lJyH|J2Jzn=V6cyp&eXo4]el1W`AQpHCCYpc;5Tu@$[P?)_a?-RV82[):[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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
OUTPUT: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
추가 규칙
문자열의 BWT (또는 그 역수)를 계산하는 내장 연산자를 사용할 수 없습니다.
기능을 반전시키는 내장 연산자를 사용할 수 없습니다.
입력에서 후행 줄 바꿈을 지원하지 않더라도 출력에 STDOUT을 선택하면 코드에서 후행 줄 바꿈을 인쇄 할 수 있습니다.
코드는 최대 1 개의 공백을 포함하여 500 개 이하의 인쇄 가능한 ASCII 문자 (0x20 ~ 0x7E)를 입력해야합니다.
위에 설명 된 가능한 입력에 대해서는 코드가 내 컴퓨터 (Intel Core i7-3770, 16 GiB RAM)에서 10 분 이내에 완료되어야합니다. 마지막 테스트 케이스는 가장 느리므로 해당 코드로 코드를 작성하십시오.
대부분의 언어와 접근 방식에서는 시간 제한을 쉽게 준수 할 수 있어야합니다. 이 규칙은 변형을 다른 것의 무차별 대입으로 구현하는 것을 막기위한 것입니다.
표준 코드 골프 규칙이 적용됩니다. 바이트 단위로 가장 짧은 제출이 이깁니다.
inv
.