21

convey, 59 47 bytes { ?;\,&:1< v^<^ ,<$1 "=>^}"@"} >">>#=" '*'>:<=0 Try it online! Run with tas and tsase (output is t*as*): Split the input into two streams ?;\… ^<, then always take one letter :1, compare it with the head =, and either @ put the letter back into the queue , and output a '*'$…}, ...


12

JavaScript (ES6), 35 bytes Expects (haystack)(needle), where haystack is a list of characters and needle is either a list of characters or a string. Returns a list of characters. The blank-out character is 0. s=>w=>s.map(c=>c==w[s|=0]?++s&&c:0) Try it online! Commented s => // s[] = sentence as an array of characters w => ...


10

Bash + coreutils, 30 (seq 0 127;seq -128 -1)|nl -v0 Try it online!


10

x86-16 machine code, 11 bytes Binary: 00000000: a674 054e 4fb0 2aaa e2f6 c3 .t.NO.*.... Listing: CHAR_LOOP: A6 CMPSB ; compare [DI] and [SI], advance both 74 05 JZ MATCH ; if same char, do nothing 4E DEC SI ; back up target word to previous char 4F DEC DI ...


9

Haskell, 61 59 44 bytes Saved 1 16 bytes thanks to @ovs! (a:b)%(c:d)|a==c=a:b%d (_:b)%c='*':b%c e%_=e Try it online!


8

C (gcc), 52 44 bytes Saved 8 bytes thanks to the man himself Arnauld!!! f(s,t)char*s,*t;{for(;*s++=*s-*t?42:*t++;);} Try it online! Function takes two input strings and return the meme-formatted string in the first parameter. Explanation f(s,t)char*s,*t;{ // function inputs two strings for(; // loop *s // ...


8

Python 3.10.0a41, 56 bytes f=lambda s,t:s and('*'+s)[x:=s[0]==t[:1]]+f(s[1:],t[x:]) Try it online! Python 3.10 allows unparenthesized assignment expressions in indexes, which saves 2 bytes over 3.8 here, which is the newest version on TIO. 1This is the version I tested locally, this will probably work in future versions as well.


7

C (gcc), 54 50 47 bytes i;main(){for(;i<256;printf("%u,%hhd ",i++,i));} Try it online! Explanation i; // Static variable initialized to 0 main() { for(;i<256; // While the variable is <= 255: printf("%u,%hhd ",i++,i)); // Output the original, then the char-...


7

Ruby -pl, 38 37 bytes ->t{gsub(/./){$&==t[0]?$&+t[0]*=0:0}} Try it online! Takes the sentence from STDIN and the target word as the lambda argument. Uses 0 as the blank-out character, an idea borrowed from @Arnauld's JavaScript answer, which saves a byte over using *. For each character in the sentence: If it is the same as the first character ...


7

05AB1E, 12 11 10 bytes v¬yQić?ë0? -1 byte by using 0 as filler character instead of *. Try it online or verify all test cases. Explanation: v # Loop over the characters `y` of the (implicit) input-sentence: ¬ # Get the first character without popping the string # (which uses the implicit input-target the first iteration) yQi # If ...


6

APL (Dyalog Extended), 18 bytes Full program printing to stdout with ¯ as negative symbol. Requires 0-based indexing. (⍳∘≢,⍪)…127,-128…1 Try it online! 128…1 integers 128 through 1 - negate those 127, prepend 127 … fill integers from 0 until the first element of that (127) (…) apply the tacit function:  ,⍪ columnify and prepend [a column consisting of]…  ⍳⍤...


6

ARM Thumb-2, 108 90 84 bytes Machine code: b5f2 2300 f000 f822 9900 000a 3a02 5a84 ba64 5284 d1fa 425b f000 f818 bdf2 5a44 f64f 56d0 1ba7 2f20 d313 0ae7 2f1b d10a b179 3902 0ae7 d30c 5a42 0a97 2f36 d108 3209 eb04 2482 b227 3702 d202 3902 d5e6 3b01 4770 Commented assembly: .syntax unified .arch armv6t2 .text .thumb ....


5

Haskell, 69 bytes A small improvement to xnor's answer. (1%) k%n|k?n==k=0|1>0=1+k?n%n k?n=maximum$k:[lcm x$k?(n-x)|x<-[1..n]] Try it online! Compared to the original solution I have simplified the definition of k?n, which calculates one iteration of the Landau function. For \$n=0\$ the function returns \$k\$ and for positive \$n\$ it always returns ...


5

Python 3, 1054 bytes def d(kx,ky,x,y):return abs(x-kx)<2>abs(y-ky) def l(qx,qy,kx,ky,x,y): if x==qx:return x!=kx or ky<min(y,qy)or max(y,qy)<ky o=kx<min(x,qx)or max(x,qx)<kx if y==qy:return o or y!=ky if x-y==qx-qy:return o or x-y!=kx-ky return x+y==qx+qy and(o or x+y!=kx+ky) def f(c,x,y):c[x][y]=1;[f(c,u,v)for v in range(max(y-1,0),...


5

R, 102 98 bytes function(s,w,`[`=substring){for(i in 1:nchar(s))`if`(s[i,i]!=w[1,1],substr(s,i,i)<-"*",w<-w[2]);s} Try it online! function(s,w, # s=sentence, w=word `[`=substring) # `[` = alias to substring function {for(i in 1:nchar(s)) # loop over all the indexes of characters in s `if`(s[i,i]!=w[1,1], # if it ...


4

JavaScript (ES6),  41 40 bytes Saved 1 byte thanks to @ovs Output format: 0,0 1,1 ... 255,-1. f=n=>n>>8?'':[~~n,128+~n^127]+' '+f(-~n) Try it online! Or maybe 39 bytes or even 38 bytes by abusing the loose output format. (But it's ugly.) Commented f = // f is a recursive function n => // taking a counter n, ...


4

Jelly, 11 10 bytes ⁹Ḷ_H%⁹żƊṢG Try it online! -1 byte thanks to Jonathan Allan Explanation ⁹Ḷ_H%⁹żƊṢG Main niladic link ⁹ 256 Ḷ [0..255] _ Subtract H half (of 256) = 128 => [-128..127] Ɗ ( % Modulo ⁹ 256 ż Zip with the list at the beginning of this ...


4

Java 10, 637 617 600 595 593 chars interface T{static void main(String[]u){String g=" ",n=g+g,m=n+g,s=m+m,h=s+s,q=h+m,o=" O-O",w=o+s+o+n,d="===",p="_____",b=d+d,e=b+b,f=m+g,t=e+d,c="|",z=" | | |",v="|-|-|",k=" []",x=k+k,r=k+g+c,y="=",a[]={h+"__"+n,b+s+"\\/...


4

Python 3, 90 80 81 bytes -10 bytes (thanks to @Danis) -Fixed error when trying to access first character (thanks for @xnor for reporting) +1 byte: Fixing return error def f(t,g,i=0): l=['*']*len(t) for c in g:i=t.find(c,i);l[i]=c*(i>=0) return l Try it online!


4

Racket, 140 bytes (define(f s t[a'()])(if(null? s)(reverse a)(if(char=?(car s)(if(null? t)#\*(car t)))(f(cdr s)(cdr t)(cons(car s)a))(f(cdr s)t(cons #\*a))))) Try it online! I know, this is super long and silly.


4

Perl 5 -plF, 31 bytes $_=<>;s/./$&ne$F[0]||shift@F/ge Try it online! Input is on two lines. The first line is the target word. The second line is the sentence. Uses 1 as the blanking character.


4

Japt, 9 bytes ®¥VÎ?Vj:Q Try it input: > sentence as a string > target as a char array output blanked out with " ® - for each char in sentence: ¥VÎ? - == to first element in target? Vj - returns first element and remove it from array :Q - character "


4

Python 2, 46 bytes x=y=-1 while 1:print 2-x%2;x^=y&~-~y;y=-~y|x/2 Try it online! Based on this blog post, but golfed better. Has the bonus advantage of only using logarithmic space.


3

K (ngn/k), 14 bytes {x@&(!#x)=x?x} Try it online! A ngn/k implementation of the classic APL idiom for unique-ifying a list. x?x find the indices of the first time each character appears in the input (!#x) generate 0..n, where n is the length of the input (...)=... build boolean list storing whether or not the first index of each character in the input ...


3

05AB1E, 11 10 bytes ₅ÝƵQݱ«ø» -1 byte thanks to @ovs. Uses single spaces and newlines as delimiters for the output. Try it online. Explanation: ₅Ý # Push a list in the range [0,255] ƵQÝ # Push a list in the range [0,127]  # Bifurcate it; short for Duplicate & Reverse copy ± # Get the bitwise-NOT of each (n → -n-1) « ...


3

Python 2, 37 bytes for i in range(256):print i,127-i^127 Try it online!


3

Husk, 16 bytes †szeŀ256Sṙohṡ128 Try it online!, Another method, Another method Explanation †szeŀ256Sṙohṡ128 ṡ128 symmetric range of 128 [-128...128] oh remove last element Sṙ rotate 128 spaces ŀ256 range [0...255] ze zip the two, creating pairs †s convert all the numbers to ...


3

K (ngn/k), 78 76 60 bytes -16 bytes from using @ngn's version {(,()){(,y),+|x}/|,/{1_{1_y,*x}':x,,*x}'0N 4#-1_*'(|+1_)\x}/ Try it online! {...}/ use the "do" variant of / to run the function x times, seeded with y and returning the last result. (each iteration rotates each ring of the input matrix one position) (|+1_)\x peel off the first row, ...


3

Nim -d:danger, 33 32 bytes for b in 0..255:b.echo' ',b.int8 Try it online! Nim, 40 39 bytes for b in 0..255:b.echo' ',cast[int8](b) Try it online! Probably doesn't work on big-endian architectures.


3

AWK, 48 bytes split($0,a,e){for(i in a)printf a[j=a[i]]++?e:j} Try it online! { split($0,a,e); # Splits the input into the _a_ array, one char for each element. # _e_ variable is not assigned, and returns "". for(i in a) # For each element _i_ of the array _a_, printf a[j=a[i]]++? # if the element a[i] (AKA j)...


Only top voted, non community-wiki answers of a minimum length are eligible