Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

deleted 119 characters in body
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

05AB1E, 31(削除) 31 (削除ここまで) 30 bytes

'.©1.;1¡ε1úDAмS¡õKεgθ]J®ý1;1¡ε1ú.γa}ιθεgθ]J®ý1/0Ü®Ü

Try it online Try it online or verify all test cases verify all test cases.

'. '# Push "."
 © # Store it in variable `®` (without popping)
 1.; # Replace the first "." in the (implicit) input with a 1
 1¡ # Then split on that 1
 ε # Map over both parts:
   } # PrependAdjacent agroup spaceby:
 D  a # Duplicate it
Is alphabetic?
  ι # Remove all (lowercase) lettersUninterleave frominto thetwo copyparts
  θ # Split the string onOnly allkeep the remaining (non-letter) chars
 õK  #last Removepart anywith emptythe substringwords
 ε # Map over the words:
 g # Pop and push its length
 θ # Pop and keep its last digit (aka mod-10)
 ] # Close the nested maps
 J # Join each inner-most lists of digits together
 ®ý # Join both parts back together with a "."-delimiter
1/ # Divide it by 1 to remove trailing/leading 0s (which also
 # adds a ".0" to any integers)
 0Ü # Remove the trailing 0
 ®Ü # Remove the trailing "."
 # (after which the result is output implicitly as result)

05AB1E, 31 bytes

'.©1.;1¡ε1úDAмS¡õKεgθ]J®ý1/0Ü®Ü

Try it online or verify all test cases.

'. '# Push "."
 © # Store it in variable `®` (without popping)
 1.; # Replace the first "." in the (implicit) input with a 1
 1¡ # Then split on that 1
 ε # Map over both parts:
  # Prepend a space
 D  # Duplicate it
  # Remove all (lowercase) letters from the copy
  # Split the string on all the remaining (non-letter) chars
 õK  # Remove any empty substring
 ε # Map over the words:
 g # Pop and push its length
 θ # Pop and keep its last digit (aka mod-10)
 ] # Close the nested maps
 J # Join each inner-most lists of digits together
 ®ý # Join both parts back together with a "."-delimiter
1/ # Divide it by 1 to remove trailing/leading 0s (which also
 # adds a ".0" to any integers)
 0Ü # Remove the trailing 0
 ®Ü # Remove the trailing "."
 # (after which the result is output implicitly as result)

05AB1E, (削除) 31 (削除ここまで) 30 bytes

'.©1.;1¡ε1ú.γa}ιθεgθ]J®ý1/0Ü®Ü

Try it online or verify all test cases.

'. '# Push "."
 © # Store it in variable `®` (without popping)
 1.; # Replace the first "." in the (implicit) input with a 1
 1¡ # Then split on that 1
 ε # Map over both parts:
  } # Adjacent group by:
 a # Is alphabetic?
 ι # Uninterleave into two parts
 θ # Only keep the last part with the words
 ε # Map over the words:
 g # Pop and push its length
 θ # Pop and keep its last digit (aka mod-10)
 ] # Close the nested maps
 J # Join each inner-most lists of digits together
 ®ý # Join both parts back together with a "."-delimiter
1/ # Divide it by 1 to remove trailing/leading 0s (which also
 # adds a ".0" to any integers)
 0Ü # Remove the trailing 0
 ®Ü # Remove the trailing "."
 # (after which the result is output implicitly as result)
Source Link
Kevin Cruijssen
  • 136.2k
  • 14
  • 154
  • 394

05AB1E, 31 bytes

'.©1.;1¡ε1úDAмS¡õKεgθ]J®ý1/0Ü®Ü

Try it online or verify all test cases.

Explanation:

'. '# Push "."
 © # Store it in variable `®` (without popping)
 1.; # Replace the first "." in the (implicit) input with a 1
 1¡ # Then split on that 1
 ε # Map over both parts:
 1ú # Prepend a space
 D # Duplicate it
 Aм # Remove all (lowercase) letters from the copy
 S¡ # Split the string on all the remaining (non-letter) chars
 õK # Remove any empty substring
 ε # Map over the words:
 g # Pop and push its length
 θ # Pop and keep its last digit (aka mod-10)
 ] # Close the nested maps
 J # Join each inner-most lists of digits together
 ®ý # Join both parts back together with a "."-delimiter
1/ # Divide it by 1 to remove trailing/leading 0s (which also
 # adds a ".0" to any integers)
 0Ü # Remove the trailing 0
 ®Ü # Remove the trailing "."
 # (after which the result is output implicitly as result)

AltStyle によって変換されたページ (->オリジナル) /