Skip to main content
-bytes again
Source Link
V. Courtois
  • 946
  • 5
  • 15

Scala, 326305 bytes

Well, I'm pretty sure this can be golfed out. But still, it exists. Takes input lowercase. f prints out the result in stdout.

EDIT: -8 chars thanks to me not being dumb anymore (spaces); -13 chars thanks to crater2150

var k=Seq("bi","ba","bo","bu")
k++=k.dropRight(1)init.flatMap(a=>Seq("di","da","do","du").map(b=>a+ba+_))//Putting "bu" here instead of at line 1, and in place of using dropRightinit, would be interesting... if it did not cause a typing problem
var m=Seq("").drop(1)//Forced to do this to make m be a Seq[String] and not a Seq[Any]
def g(a:Seq[String],b:Int)=k.indexOf(a(b)).toHexString
def f(a:String){a.split('b').drop(1).foreach(x => m :+= "b" + x)
var i = 0
while(i<m.length){print(Integer.parseInt(g(m,i)+g(m,i+1),16).toChar)
i+=2}}

Try it online!

Sadly flatMap is not that worth...

342 bytes

var k=Seq("bi","ba","bo","bu","bidi","bida","bido","bidu","badi","bada","bado","badu","bodi","boda","bodo","bodu")
var m=Seq("").dropm=Seq[String](1)
def g(a:Seq[String],b:Int)=k.indexOf(a(b)).toHexString
def f(a:String){a.split('b').drop(1).foreach(x => m x=>m:+= "b" + x+="b"+x)
var i = 0i=0
while(i<m.length){print(Integer.parseInt(g(m,i)+g(m,i+1),16).toChar)
i+=2}}

Try it online!Try it online!

Scala, 326 bytes

Well, I'm pretty sure this can be golfed out. But still, it exists. Takes input lowercase. f prints out the result in stdout.

var k=Seq("bi","ba","bo","bu")
k++=k.dropRight(1).flatMap(a=>Seq("di","da","do","du").map(b=>a+b))//Putting "bu" here instead of at line 1, and in place of using dropRight, would be interesting... if it did not cause a typing problem
var m=Seq("").drop(1)//Forced to do this to make m be a Seq[String] and not a Seq[Any]
def g(a:Seq[String],b:Int)=k.indexOf(a(b)).toHexString
def f(a:String){a.split('b').drop(1).foreach(x => m :+= "b" + x)
var i = 0
while(i<m.length){print(Integer.parseInt(g(m,i)+g(m,i+1),16).toChar)
i+=2}}

Try it online!

Sadly flatMap is not that worth...

342 bytes

var k=Seq("bi","ba","bo","bu","bidi","bida","bido","bidu","badi","bada","bado","badu","bodi","boda","bodo","bodu")
var m=Seq("").drop(1)
def g(a:Seq[String],b:Int)=k.indexOf(a(b)).toHexString
def f(a:String){a.split('b').drop(1).foreach(x => m :+= "b" + x)
var i = 0
while(i<m.length){print(Integer.parseInt(g(m,i)+g(m,i+1),16).toChar)
i+=2}}

Try it online!

Scala, 305 bytes

Well, I'm pretty sure this can be golfed out. But still, it exists. Takes input lowercase. f prints out the result in stdout.

EDIT: -8 chars thanks to me not being dumb anymore (spaces); -13 chars thanks to crater2150

var k=Seq("bi","ba","bo","bu")
k++=k.init.flatMap(a=>Seq("di","da","do","du").map(a+_))//Putting "bu" here instead of at line 1, and in place of using init, would be interesting... if it did not cause a typing problem
var m=Seq[String]()
def g(a:Seq[String],b:Int)=k.indexOf(a(b)).toHexString
def f(a:String){a.split('b').drop(1).foreach(x=>m:+="b"+x)
var i=0
while(i<m.length){print(Integer.parseInt(g(m,i)+g(m,i+1),16).toChar)
i+=2}}

Try it online!

Source Link
V. Courtois
  • 946
  • 5
  • 15

Scala, 326 bytes

Well, I'm pretty sure this can be golfed out. But still, it exists. Takes input lowercase. f prints out the result in stdout.

var k=Seq("bi","ba","bo","bu")
k++=k.dropRight(1).flatMap(a=>Seq("di","da","do","du").map(b=>a+b))//Putting "bu" here instead of at line 1, and in place of using dropRight, would be interesting... if it did not cause a typing problem
var m=Seq("").drop(1)//Forced to do this to make m be a Seq[String] and not a Seq[Any]
def g(a:Seq[String],b:Int)=k.indexOf(a(b)).toHexString
def f(a:String){a.split('b').drop(1).foreach(x => m :+= "b" + x)
var i = 0
while(i<m.length){print(Integer.parseInt(g(m,i)+g(m,i+1),16).toChar)
i+=2}}

Try it online!

Sadly flatMap is not that worth...

342 bytes

var k=Seq("bi","ba","bo","bu","bidi","bida","bido","bidu","badi","bada","bado","badu","bodi","boda","bodo","bodu")
var m=Seq("").drop(1)
def g(a:Seq[String],b:Int)=k.indexOf(a(b)).toHexString
def f(a:String){a.split('b').drop(1).foreach(x => m :+= "b" + x)
var i = 0
while(i<m.length){print(Integer.parseInt(g(m,i)+g(m,i+1),16).toChar)
i+=2}}

Try it online!