clear markdown feedback
clear markdown feedback
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 3798834 fiddles created (41837 in the last week).

CREATE TABLE t(s,w) AS SELECT 'I do not control the speed at which lobsters die', 'code' FROM DUAL UNION ALL SELECT 'testcase string', 'tas' FROM DUAL UNION ALL SELECT 'uglhwagp qvyntzmf','ulhwagpqvyntzmf' FROM DUAL UNION ALL SELECT 'qrkacxx wwfja jsyjdffa vwfgxf','qcfvf' FROM DUAL UNION ALL SELECT 'z wzsgovhh jopw igcx muxj xmmisxdn t lmb','gcujxlb' FROM DUAL UNION ALL SELECT 'kxf jgmzejypb ya','e' FROM DUAL UNION ALL SELECT 'fe oxyk y','ex' FROM DUAL UNION ALL SELECT 'o wr fmik','owrfmik' FROM DUAL UNION ALL SELECT 'pgezt yozcyqq drxt gcvaj hx l ix xemimmox','e' FROM DUAL UNION ALL SELECT 'kqclk b hkgtrh','k' FROM DUAL UNION ALL SELECT 'sia prcrdfckg otqwvdv wzdqxvqb h xclxmaj xjdwt lzfw','crwqqhxl' FROM DUAL UNION ALL SELECT 'teatsase','tas' FROM DUAL;
12 rows affected
 hidden batch(es)


WITH r(sentence,word,sentence_pos,word_pos,output,len)AS( SELECT s, w, 1, 1, '', LENGTH(s) FROM t UNION ALL SELECT sentence, word, sentence_pos+1, DECODE( SUBSTR(sentence,sentence_pos,1), SUBSTR(word,word_pos,1), word_pos+1, word_pos ), output||DECODE( SUBSTR(sentence,sentence_pos,1), SUBSTR(word,word_pos,1), SUBSTR(word,word_pos,1), 0 ), len FROM r WHERE sentence_pos<=len ) SELECT sentence, word, output FROM r WHERE sentence_pos>len
SENTENCE WORD OUTPUT
teatsase tas t0a0s000
fe oxyk y ex 0e00x0000
o wr fmik owrfmik o0wr0fmik
kqclk b hkgtrh k k0000000000000
testcase string tas t0000as00000000
kxf jgmzejypb ya e 00000000e0000000
uglhwagp qvyntzmf ulhwagpqvyntzmf u0lhwagp0qvyntzmf
qrkacxx wwfja jsyjdffa vwfgxf qcfvf q000c00000f000000000000v0f000
z wzsgovhh jopw igcx muxj xmmisxdn t lmb gcujxlb 00000g000000000000c000u0j0x0000000000l0b
pgezt yozcyqq drxt gcvaj hx l ix xemimmox e 00e00000000000000000000000000000000000000
I do not control the speed at which lobsters die code 000000000co00000000000000d000000000000000e000000
sia prcrdfckg otqwvdv wzdqxvqb h xclxmaj xjdwt lzfw crwqqhxl 000000cr000000000w0000000q00q00h0x0l000000000000000
 hidden batch(es)


WITH r(s,w,a,b,c,l)AS(SELECT s,w,1,1,'',LENGTH(s) FROM t UNION ALL SELECT s,w,a+1,DECODE(SUBSTR(s,a,1),SUBSTR(w,b,1),b+1,b),c||DECODE(SUBSTR(s,a,1),SUBSTR(w,b,1),SUBSTR(w,b,1),0),l FROM r WHERE a<=l)SELECT c FROM r WHERE a>l
C
t0a0s000
0e00x0000
o0wr0fmik
k0000000000000
t0000as00000000
00000000e0000000
u0lhwagp0qvyntzmf
q000c00000f000000000000v0f000
00000g000000000000c000u0j0x0000000000l0b
00e00000000000000000000000000000000000000
000000000co00000000000000d000000000000000e000000
000000cr000000000w0000000q00q00h0x0l000000000000000
 hidden batch(es)