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:
1ú .γ } # PrependAdjacent agroup spaceby:
D a # Duplicate it
Is alphabetic?
Aм ι # Remove all (lowercase) lettersUninterleave frominto thetwo copyparts
S¡ θ # 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:
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)
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)
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)