“Ð/ṃƇ¬þṄẊƙ€,⁽ṙƬ®OṪJ"ɦ3×kf3Ṙç%ġu’b26ịØaṣ”z
e€¢¬T;2Ḷ¤
ḲŒtǦK
TryItOnline! 또는 모든 테스트를 실행
방법?
단어를 분리 구역으로 압축 된 문자열이 될 47IT 비용 분할 바이트 1에 대한 바이트를 48바이트.
길이의 말씀의 두 분리되지 않은 압축 된 문자열 2과 3각각 것 (하나의 끝 부분에 'A'와) 40바이트 + 2각을 분할하고 1위해, 그들과 합류하는 45바이트.
아래에 설명 된대로 하나 개의 기본 250 수는 32바이트, 다음 3,베이스 (26)로 변환 3소문자 알파벳으로 색인하고 3, 사용되지 않는 문자에 분할 'z'을 위해, 41바이트.
따라서 대문자를 사용하지 않는 단어에 대한 조회는 다음
“Ð/ṃƇ¬þṄẊƙ€,⁽ṙƬ®OṪJ"ɦ3×kf3Ṙç%ġu’
과 같이 구성되었습니다.
그 단어를 가져 와서 구분 기호로 결합하십시오.
s="a an the at by for in of on to up and as but or nor"
다음 라벨 'a'로서 1, 'b'같은 2세퍼레이터와 같이 0:
alpha = ' abcdefghijklmnopqrstuvwxyz'
x = [alpha.index(v) for v in s]
x
[1,0,1,14,0,20,8,5,0,1,20,0,2,25,0,6,15,18,0,9,14,0,15,6,0,15,14,0,20,15,0,21,16,0,1,14,4,0,1,19,0,2,21,20,0,15,18,0,14,15,18]
이것을 기본 26숫자 로 변환하십시오 (마지막으로 사용한 문자 'y'는 구분 기호의 숫자와 파이썬 코드입니다 :
n=sum(v*26**i for i,v in enumerate(x[::-1]))
250숫자를 목록을 사용하여 기본 번호 로 변환하십시오 .
b=[]
while n:
n,d = divmod(n,250)
b=[d]+b
b
[16,48,220,145,8,32,202,209,162,13,45,142,244,153,9,80,207,75,35,161,52,18,108,103,52,205,24,38,237,118]
젤리의 코드 페이지에서 해당 색인의 문자를 찾으십시오.
codepage = '''¡¢£¤¥¦©¬®µ½¿€ÆÇÐÑרŒÞßæçðıȷñ÷øœþ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQR TUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~¶°¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ƁƇƊƑƓƘⱮƝƤƬƲȤɓƈɗƒɠɦƙɱɲƥʠɼʂƭʋȥẠḄḌẸḤỊḲḶṂṆỌṚṢṬỤṾẈỴẒȦḂĊḊĖḞĠḢİĿṀṄȮṖṘṠṪẆẊẎŻạḅḍẹḥịḳḷṃṇọṛṣṭụṿẉỵẓȧḃċḋėḟġḣŀṁṅȯṗṙṡṫẇẋẏż«»‘’“”'''
r=''.join(codepage[i-1] for i in b)
r
'Ð/ṃƇ¬þṄẊƙ€,⁽ṙƬ®OṪJ"ɦ3×kf3Ṙç%ġu'
(참고 : 실제 구현은 형 용성 b이 없으므로 0숫자가 있으면 먼저 수행해야합니다)
나머지:
ḲŒtǦK - Main link: title string
Ḳ - split on spaces
¦ - apply to indexes
Ç - given by calling the last link (1) as a monad (with the split title string)
Œt - title case (first letter of each (only) word to upper case)
K - join on spaces
e€¢¬T;2Ḷ¤ - Link 1, find indexes to capitalise: split title string
e€ - is an element of, for €ach
¢ - the result of calling the last link (2) as a nilad
¬ - logical not
T - get the truthy indexes (indexes of words that are not in the list)
; - concatenate with
¤ - nilad followed by link(s) as a nilad
2Ḷ - range(2) -> [0,1]
(we always want to capitalise the first index, 1, and the last index, 0)
“Ð/ṃƇ¬þṄẊƙ€,⁽ṙƬ®OṪJ"ɦ3×kf3Ṙç%ġu’b26ịØaṣ”z - Link 2, make the word list: no arguments
“Ð/ṃƇ¬þṄẊƙ€,⁽ṙƬ®OṪJ"ɦ3×kf3Ṙç%ġu’ - the base 250 number
b26 - convert to base 26
ị - index into
Øa - lowercase alphabet
ṣ - split on
”z - literal 'z' (the separator 0 indexes into `z`)