Skip to main content
deleted 47 characters in body
Source Link
user99151
user99151

Elixir, 184184 169 bytes

Still pretty new to Elixir, any golfing suggestions are welcome.

defmodule A do
def f x,y do
cond do
x==""->x
String.atq(x,0)==String.at==q(y,0)->String.at>q(y,0)<>f String.slicep(x),p y
1..-1>"*"<>f p(x),y
end
end
def p(x)do
String.slice(yx,1..-1)
1->"*"<>fend
def q(x)do
String.sliceat(x,1..-10),y
end
end
end

Try it online!Try it online!

Elixir, 184 bytes

Still pretty new to Elixir, any golfing suggestions are welcome.

defmodule A do
def f x,y do
cond do
x==""->x
String.at(x,0)==String.at(y,0)->String.at(y,0)<>f String.slice(x,1..-1),String.slice(y,1..-1)
1->"*"<>f String.slice(x,1..-1),y
end
end
end

Try it online!

Elixir, 184 169 bytes

defmodule A do
def f x,y do
cond do
x==""->x
q(x)==q(y)->q(y)<>f p(x),p y
1->"*"<>f p(x),y
end
end
def p(x)do
String.slice(x,1..-1)
end
def q(x)do
String.at(x,0)
end
end

Try it online!

Source Link
user99151
user99151

Elixir, 184 bytes

Still pretty new to Elixir, any golfing suggestions are welcome.

defmodule A do
def f x,y do
cond do
x==""->x
String.at(x,0)==String.at(y,0)->String.at(y,0)<>f String.slice(x,1..-1),String.slice(y,1..-1)
1->"*"<>f String.slice(x,1..-1),y
end
end
end

Try it online!