Skip to main content
Commonmark migration
Source Link

###GolfScript, 50 characters###

GolfScript, 50 characters

{[[\].zip{1/~=},,\{$}/{1$?.)!!{)>0}*)},,\;1$-]}:M;

A similar solution to chron's answer written in GolfScript. Input must be provided as two strings on the stack, the result will be the array [A B].

Examples:

"1254" "1342" M p    # => [1 2]
"1234" "1111" M p    # => [1 0]
"5441" "1234" M p    # => [0 2]
"5441" "4531" M p    # => [1 2]
"5441" "4441" M p    # => [3 0]
"5441" "5441" M p    # => [4 0]

###GolfScript, 50 characters###

{[[\].zip{1/~=},,\{$}/{1$?.)!!{)>0}*)},,\;1$-]}:M;

A similar solution to chron's answer written in GolfScript. Input must be provided as two strings on the stack, the result will be the array [A B].

Examples:

"1254" "1342" M p    # => [1 2]
"1234" "1111" M p    # => [1 0]
"5441" "1234" M p    # => [0 2]
"5441" "4531" M p    # => [1 2]
"5441" "4441" M p    # => [3 0]
"5441" "5441" M p    # => [4 0]

GolfScript, 50 characters

{[[\].zip{1/~=},,\{$}/{1$?.)!!{)>0}*)},,\;1$-]}:M;

A similar solution to chron's answer written in GolfScript. Input must be provided as two strings on the stack, the result will be the array [A B].

Examples:

"1254" "1342" M p    # => [1 2]
"1234" "1111" M p    # => [1 0]
"5441" "1234" M p    # => [0 2]
"5441" "4531" M p    # => [1 2]
"5441" "4441" M p    # => [3 0]
"5441" "5441" M p    # => [4 0]
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

###GolfScript, 50 characters###

{[[\].zip{1/~=},,\{$}/{1$?.)!!{)>0}*)},,\;1$-]}:M;

A similar solution to chron's answerchron's answer written in GolfScript. Input must be provided as two strings on the stack, the result will be the array [A B].

Examples:

"1254" "1342" M p    # => [1 2]
"1234" "1111" M p    # => [1 0]
"5441" "1234" M p    # => [0 2]
"5441" "4531" M p    # => [1 2]
"5441" "4441" M p    # => [3 0]
"5441" "5441" M p    # => [4 0]

###GolfScript, 50 characters###

{[[\].zip{1/~=},,\{$}/{1$?.)!!{)>0}*)},,\;1$-]}:M;

A similar solution to chron's answer written in GolfScript. Input must be provided as two strings on the stack, the result will be the array [A B].

Examples:

"1254" "1342" M p    # => [1 2]
"1234" "1111" M p    # => [1 0]
"5441" "1234" M p    # => [0 2]
"5441" "4531" M p    # => [1 2]
"5441" "4441" M p    # => [3 0]
"5441" "5441" M p    # => [4 0]

###GolfScript, 50 characters###

{[[\].zip{1/~=},,\{$}/{1$?.)!!{)>0}*)},,\;1$-]}:M;

A similar solution to chron's answer written in GolfScript. Input must be provided as two strings on the stack, the result will be the array [A B].

Examples:

"1254" "1342" M p    # => [1 2]
"1234" "1111" M p    # => [1 0]
"5441" "1234" M p    # => [0 2]
"5441" "4531" M p    # => [1 2]
"5441" "4441" M p    # => [3 0]
"5441" "5441" M p    # => [4 0]
Source Link
Howard
  • 23.6k
  • 2
  • 44
  • 83

###GolfScript, 50 characters###

{[[\].zip{1/~=},,\{$}/{1$?.)!!{)>0}*)},,\;1$-]}:M;

A similar solution to chron's answer written in GolfScript. Input must be provided as two strings on the stack, the result will be the array [A B].

Examples:

"1254" "1342" M p    # => [1 2]
"1234" "1111" M p    # => [1 0]
"5441" "1234" M p    # => [0 2]
"5441" "4531" M p    # => [1 2]
"5441" "4441" M p    # => [3 0]
"5441" "5441" M p    # => [4 0]