η.ΔžOSåàyžPSÅ¿à*}ÐIsKžOÃнsθU.•gÍĆdQ¸G•SDXåiÂXQÏθë\X}ìDJ
オンラインそれを試してみたり、すべてのテストケースを確認してください。
説明:
η # Suffixes of the (implicit) input
# i.e. "creation" → ["c","cr","cre","crea","creat","creati","creato","creatio","creation"]
.Δ } # Find the first for which the following is truthy:
žO # Push vowels (including y): "aeiouy"
S # Convert it to a list of characters: ["a","e","i","o","u","y"]
å # Check for each if they're in the current (implicit) suffix
# i.e. "creat" → [1,1,0,0,0,0]
à # Pop and push the max (basically check if any are truthy)
# i.e. [1,1,0,0,0,0] → 1
y # Push the suffix again
žP # Push the consonants (excluding y): "bcdfghjklmnpqrstvwxz"
S # Convert to a list of characters: ["b","c","d","f","g","h","j","k","l","m","n","p","q","r","s","t","v","w","x","z"]
Å¿ # Check for each if the suffix ends with it
# i.e. "creat" → [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0]
à # Pop and push the max (basically check if any are truthy)
# i.e. [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0] → 1
* # Check if both are truthy
# i.e. 1 and 1 → 1
Ð # Triplicate the found suffix
I # Push the input
s # Swap the top two items on the stack
# i.e. stack contains now: "creat","creat","creation","creat"
K # Remove the suffix from the input
# i.e. "creation" and "creat" → "ion"
žOÃ # Only leave the vowels
# i.e. "ion" → "io"
н # Pop and push the first character
# i.e. "io" → "i"
s # Swap again so the prefix is a the top of the stack again
θ # Pop and push the last character
# i.e. "creat" → "t"
U # Pop and store it in variable `X`
.•gÍĆdQ¸G• # Push string "bcdfkszgvtgp"
S # Convert to list of characters: ["b","c","d","f","k","s","z","g","v","t","g","p"]
D # Duplicate it
Xåi # If `X` is in this string:
 # Bifurcate the list (short for Duplicate & Reverse copy)
# i.e. ["b","c","d","f","k","s","z","g","v","t","g","p"]
# → ["p","g","t","v","g","z","s","k","f","d","c","b"]
XQ # Check if they're equal to variable `X`
# i.e. `X` = "t" → [0,0,1,0,0,0,0,0,0,0,0,0]
Ï # Only keep the truthy values
# i.e. ["b","c",...,"g","p"] and [0,0,1,0,0,0,0,0,0,0,0,0]
# → ["d"]
θ # Pop and push the last one
# i.e. ["d"] → "d"
ë # Else:
\ # Discard the duplicate list from the stack
X # And push variable `X` again
} # Close the if-else
ì # Prepend the second character in front of the first
# i.e. "d" and "i" → "di"
D # Duplicate it
J # Join the stack together (and output implicitly)
# i.e. "creat" and "di" and "di" → "creatdidi"
私のこの05AB1Eのヒントを参照してください(セクション文字列ではない辞書の一部を圧縮する方法は?)理由を理解すること.•gÍĆdQ¸G•
です"bcdfkszgvtgp"
。