## Elias delta to Fibonacci by tapasa

```\x0d
n=1000\x0d
\x0d
def fib num\x0d
ans=[]\x0d
a=1;b=1;num.times{|i| ans +=[a];c=b+a;a=b;b=c}\x0d
ans\x0d
end\x0d
\x0d
\$fibo=fib(n)\x0d
\x0d
def fibc d\x0d
1000.times{|i|\x0d
fc=\$fibo[i]\x0d
if  d <fc; return [i-1,d-\$fibo[i-1]]\x0d
end\x0d
}\x0d
end\x0d
\x0d
\x0d
def fibby ii\x0d
fbc =fibc(ii)\x0d
a ="0"*(fbc[0]-1)+"11"\x0d
#print \$fibo[fbc[0]],">"\x0d
nc=[]\x0d
if fbc[1]>0\x0d
while fbc[1]>0\x0d
#print fbc[1],">"\x0d
fbc=fibc(fbc[1])\x0d
ii=fbc[0]\x0d
nc+=[ii] #if isfib(ii)\x0d
ii=fbc[1]\x0d
end\x0d
end\x0d
nc.each{|j|\x0d
a[j-1..j-1]="1"\x0d
}\x0d
a\x0d
end\x0d
\x0d
\x0d
def tofibcode d\x0d
fbc=fibc(d)\x0d
ans="0"*(fbc[0]-1)+"1"\x0d
ans[fbc[1]-1]="1"[0]\x0d
ans+"1"\x0d
end\x0d
\x0d
def bi a\x0d
v=0\x0d
a.length.times{|i|\x0d
v*=2\x0d
v+=a[i..i].to_i\x0d
}\x0d
v\x0d
end\x0d
\x0d
\x0d
/^(0*)1/=~d[pos,d.length]\x0d
if(\$1==nil)\x0d
return [1,1]\x0d
end\x0d
n= \$1.length\x0d
s=d[pos+n+1,n]\x0d
nn=2**n+bi(s)\x0d
nnn=d[pos+n*2+1,nn-1]\x0d
#p nnn,bi(nnn)\x0d
#p \$1,s,nn,nnn,2**(nn-1)+bi(nnn)\x0d
[2**(nn-1)+bi(nnn),n+1+n+nn-1]\x0d
end\x0d
\x0d
while gets\x0d
n=0\x0d
da=\$_.chomp\x0d
#p da\x0d
dd=""\x0d
dla=""\x0d
dnum=""\x0d
while da.length>n\x0d
if a[0]==nil;break;end\x0d
#print fibby(a[0]),"."\x0d
dnum+=a[0].to_s+"."\x0d
dd+=fibby(a[0])\x0d
dla+=da[n,a[1]]+"."\x0d
n+=a[1]\x0d
end\x0d
puts dd\x0d
end\x0d
```

Note that non-ascii characters in the above source code will be escaped (such as \x9f).