Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

deleted 10 characters in body
Source Link
J.Doe
  • 2.7k
  • 12
  • 15

R, 9695 bytes

Just run through the upper case alphabet repeatedly while advancing a counter by 1 if you encounter the letter in the counter position of the word and printing out the letter, a space otherwise.

function(s)while(F>""){for(l in LETTERS)cat("if"((F=substr(s,T,T))==l,{~l;T=T+1T=T+1;l},~"" ");~");cat("
")}
"~"=cat

Try it online! Try it online!

R, 96 bytes

Just run through the upper case alphabet repeatedly while advancing a counter by 1 if you encounter the letter in the counter position of the word and printing out the letter, a space otherwise.

function(s)while(F>""){for(l in LETTERS)"if"((F=substr(s,T,T))==l,{~l;T=T+1},~" ");~"
"}
"~"=cat

Try it online!

R, 95 bytes

Just run through the upper case alphabet repeatedly while advancing a counter by 1 if you encounter the letter in the counter position of the word and printing out the letter, a space otherwise.

function(s)while(F>""){for(l in LETTERS)cat("if"((F=substr(s,T,T))==l,{T=T+1;l}," "));cat("
")}

Try it online!

deleted 14 characters in body
Source Link
J.Doe
  • 2.7k
  • 12
  • 15

R, 9996 bytes

Just run through the upper case alphabet repeatedly while advancing a counter that increases by 1 if you encounter the letter in the counter position of the word and printing out the letter, a space otherwise.

function(s)while(T<=nchar(s)F>""){for(l in LETTERS)"if"(substr(F=substr(s,T,T))==l,{~l;T=T+1},~" ");~"
"}
"~"=cat

Try it online! Try it online!

R, 99 bytes

Just run through the upper case alphabet repeatedly while advancing a counter that increases by 1 if you encounter the letter in the counter position of the word and printing out the letter, a space otherwise.

function(s)while(T<=nchar(s)){for(l in LETTERS)"if"(substr(s,T,T)==l,{~l;T=T+1},~" ");~"
"}
"~"=cat

Try it online!

R, 96 bytes

Just run through the upper case alphabet repeatedly while advancing a counter by 1 if you encounter the letter in the counter position of the word and printing out the letter, a space otherwise.

function(s)while(F>""){for(l in LETTERS)"if"((F=substr(s,T,T))==l,{~l;T=T+1},~" ");~"
"}
"~"=cat

Try it online!

Source Link
J.Doe
  • 2.7k
  • 12
  • 15

R, 99 bytes

Just run through the upper case alphabet repeatedly while advancing a counter that increases by 1 if you encounter the letter in the counter position of the word and printing out the letter, a space otherwise.

function(s)while(T<=nchar(s)){for(l in LETTERS)"if"(substr(s,T,T)==l,{~l;T=T+1},~" ");~"
"}
"~"=cat

Try it online!

AltStyle によって変換されたページ (->オリジナル) /