Skip to main content
Commonmark migration
Source Link

#R, 118 114 bytes function(a)while(grepl("[^ ]",a)){F=F+1;cat(a,"\n");for(j in c("[^a-zA-Z]",letters[F],LETTERS[F]))a=gsub(j," ",a)}

R, 118 114 bytes

function(a)while(grepl("[^ ]",a)){F=F+1;cat(a,"\n");for(j in c("[^a-zA-Z]",letters[F],LETTERS[F]))a=gsub(j," ",a)}

Thanks to @Giuseppe for those 4 bytes off

Try it online!

Short explanation:

function(a)
    while(grepl("[^ ]",a)){ #As long as the string is not just spaces.
        F=F+1 #Increment letter counter (F is FALSE, hence 0 by default)
        cat(a,"\n") #Print string
        for(j in c("[^a-zA-Z]",letters[F],LETTERS[F])) #Get rid of non-letters, and the current letter in lower and upper case
             a=gsub(j," ",a)
    }

#R, 118 114 bytes function(a)while(grepl("[^ ]",a)){F=F+1;cat(a,"\n");for(j in c("[^a-zA-Z]",letters[F],LETTERS[F]))a=gsub(j," ",a)}

Thanks to @Giuseppe for those 4 bytes off

Try it online!

Short explanation:

function(a)
    while(grepl("[^ ]",a)){ #As long as the string is not just spaces.
        F=F+1 #Increment letter counter (F is FALSE, hence 0 by default)
        cat(a,"\n") #Print string
        for(j in c("[^a-zA-Z]",letters[F],LETTERS[F])) #Get rid of non-letters, and the current letter in lower and upper case
             a=gsub(j," ",a)
    }

R, 118 114 bytes

function(a)while(grepl("[^ ]",a)){F=F+1;cat(a,"\n");for(j in c("[^a-zA-Z]",letters[F],LETTERS[F]))a=gsub(j," ",a)}

Thanks to @Giuseppe for those 4 bytes off

Try it online!

Short explanation:

function(a)
    while(grepl("[^ ]",a)){ #As long as the string is not just spaces.
        F=F+1 #Increment letter counter (F is FALSE, hence 0 by default)
        cat(a,"\n") #Print string
        for(j in c("[^a-zA-Z]",letters[F],LETTERS[F])) #Get rid of non-letters, and the current letter in lower and upper case
             a=gsub(j," ",a)
    }
added 30 characters in body
Source Link
plannapus
  • 9k
  • 22
  • 47

#R, 118 114 bytes function(a)while(grepl("[^ ]",a)){F=F+1;cat(a,"\n");for(j in c("[^a-zA-Z]",letters[F],LETTERS[F]))a=gsub(j," ",a)}

Thanks to @Giuseppe for those 4 bytes off

Try it online!

Short explanation:

function(a)
    while(grepl("[^ ]",a)){ #As long as the string is not just spaces.
        F=F+1 #Increment letter counter (F is FALSE, hence 0 by default)
        cat(a,"\n") #Print string
        for(j in c("[^a-zA-Z]",letters[F],LETTERS[F])) #Get rid of non-letters, and the current letter in lower and upper case
             a=gsub(j," ",a)
    }

#R, 118 114 bytes function(a)while(grepl("[^ ]",a)){F=F+1;cat(a,"\n");for(j in c("[^a-zA-Z]",letters[F],LETTERS[F]))a=gsub(j," ",a)}

Thanks to @Giuseppe for those 4 bytes off

Try it online!

#R, 118 114 bytes function(a)while(grepl("[^ ]",a)){F=F+1;cat(a,"\n");for(j in c("[^a-zA-Z]",letters[F],LETTERS[F]))a=gsub(j," ",a)}

Thanks to @Giuseppe for those 4 bytes off

Try it online!

Short explanation:

function(a)
    while(grepl("[^ ]",a)){ #As long as the string is not just spaces.
        F=F+1 #Increment letter counter (F is FALSE, hence 0 by default)
        cat(a,"\n") #Print string
        for(j in c("[^a-zA-Z]",letters[F],LETTERS[F])) #Get rid of non-letters, and the current letter in lower and upper case
             a=gsub(j," ",a)
    }
added 30 characters in body
Source Link
plannapus
  • 9k
  • 22
  • 47

#R, 118118 114 bytes function(a,i=1)while(grepl("[^ ]",a)){catF=F+1;cat(a,"\n");for(j in c("[^a-zA-Z]",letters[i]letters[F],LETTERS[i]LETTERS[F]))a=gsub(j," ",a);i=i+1}

Try it online! Thanks to @Giuseppe for those 4 bytes off

Try it online!

#R, 118 bytes function(a,i=1)while(grepl("[^ ]",a)){cat(a,"\n");for(j in c("[^a-zA-Z]",letters[i],LETTERS[i]))a=gsub(j," ",a);i=i+1}

Try it online!

#R, 118 114 bytes function(a)while(grepl("[^ ]",a)){F=F+1;cat(a,"\n");for(j in c("[^a-zA-Z]",letters[F],LETTERS[F]))a=gsub(j," ",a)}

Thanks to @Giuseppe for those 4 bytes off

Try it online!

Source Link
plannapus
  • 9k
  • 22
  • 47
Loading