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

Commonmark migration
Source Link

GNU sed + coreutils, 55 bytes

#GNU sed + coreutils, 55 bytes (including +1 for -r flag)

s/^/factor /e
s/ ([^ ]+)(( 1円)*)/2円/g
s/[^ ]//g
y/ /1/

Input in decimal, on stdin; output in unary, on stdout.

##Explanation

Explanation

#!/bin/sed -rf
# factor the number
s/^/factor /e
# remove first of each number repeated 0 or more times
s/ ([^ ]+)(( 1円)*)/2円/g
# count just the spaces
s/[^ ]//g
y/ /1/

#GNU sed + coreutils, 55 bytes (including +1 for -r flag)

s/^/factor /e
s/ ([^ ]+)(( 1円)*)/2円/g
s/[^ ]//g
y/ /1/

Input in decimal, on stdin; output in unary, on stdout.

##Explanation

#!/bin/sed -rf
# factor the number
s/^/factor /e
# remove first of each number repeated 0 or more times
s/ ([^ ]+)(( 1円)*)/2円/g
# count just the spaces
s/[^ ]//g
y/ /1/

GNU sed + coreutils, 55 bytes

(including +1 for -r flag)

s/^/factor /e
s/ ([^ ]+)(( 1円)*)/2円/g
s/[^ ]//g
y/ /1/

Input in decimal, on stdin; output in unary, on stdout.

Explanation

#!/bin/sed -rf
# factor the number
s/^/factor /e
# remove first of each number repeated 0 or more times
s/ ([^ ]+)(( 1円)*)/2円/g
# count just the spaces
s/[^ ]//g
y/ /1/
Added prettify hint
Source Link
Toby Speight
  • 7k
  • 1
  • 30
  • 43

#GNU sed + coreutils, 55 bytes (including +1 for -r flag)

s/^/factor /e
s/ ([^ ]+)(( 1円)*)/2円/g
s/[^ ]//g
y/ /1/

Input in decimal, on stdin; output in unary, on stdout.

##Explanation
#!/bin/sed -rf
# factor the number
s/^/factor /e
# remove first of each number repeated 0 or more times
s/ ([^ ]+)(( 1円)*)/2円/g
# count just the spaces
s/[^ ]//g
y/ /1/

##Explanation

#!/bin/sed -rf
# factor the number
s/^/factor /e
# remove first of each number repeated 0 or more times
s/ ([^ ]+)(( 1円)*)/2円/g
# count just the spaces
s/[^ ]//g
y/ /1/

#GNU sed + coreutils, 55 bytes (including +1 for -r flag)

s/^/factor /e
s/ ([^ ]+)(( 1円)*)/2円/g
s/[^ ]//g
y/ /1/

Input in decimal, on stdin; output in unary, on stdout.

##Explanation
#!/bin/sed -rf
# factor the number
s/^/factor /e
# remove first of each number repeated 0 or more times
s/ ([^ ]+)(( 1円)*)/2円/g
# count just the spaces
s/[^ ]//g
y/ /1/

#GNU sed + coreutils, 55 bytes (including +1 for -r flag)

s/^/factor /e
s/ ([^ ]+)(( 1円)*)/2円/g
s/[^ ]//g
y/ /1/

Input in decimal, on stdin; output in unary, on stdout.

##Explanation

#!/bin/sed -rf
# factor the number
s/^/factor /e
# remove first of each number repeated 0 or more times
s/ ([^ ]+)(( 1円)*)/2円/g
# count just the spaces
s/[^ ]//g
y/ /1/
Source Link
Toby Speight
  • 7k
  • 1
  • 30
  • 43

#GNU sed + coreutils, 55 bytes (including +1 for -r flag)

s/^/factor /e
s/ ([^ ]+)(( 1円)*)/2円/g
s/[^ ]//g
y/ /1/

Input in decimal, on stdin; output in unary, on stdout.

##Explanation
#!/bin/sed -rf
# factor the number
s/^/factor /e
# remove first of each number repeated 0 or more times
s/ ([^ ]+)(( 1円)*)/2円/g
# count just the spaces
s/[^ ]//g
y/ /1/

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