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

added 96 characters in body
Source Link
JayCe
  • 3k
  • 13
  • 17

R, 135 bytes

Inspired by this Python answer .

Previous versions were broken. Thanks to @Giuseppe for pointing out that paste was not required alsoit saved 18 bytes or so. lengths(regmatches(z,gregexpr(x,z)))is from this answer.

function(x,z=rep(c("afilo2679=:","hmpu15'","nstxz","cgr","e","()",'"',","),c(2:5,7,9,15,16)))sum(lengths(regmatches(z,gregexpr(x,z))))

Try it online!

R, 135 bytes

Previous versions were broken. Thanks to @Giuseppe for pointing out that paste was not required also saved 18 bytes or so. lengths(regmatches(z,gregexpr(x,z)))is from this answer.

function(x,z=rep(c("afilo2679=:","hmpu15'","nstxz","cgr","e","()",'"',","),c(2:5,7,9,15,16)))sum(lengths(regmatches(z,gregexpr(x,z))))

Try it online!

R, 135 bytes

Inspired by this Python answer .

Previous versions were broken. Thanks to @Giuseppe for pointing out that paste was not required it saved 18 bytes or so. lengths(regmatches(z,gregexpr(x,z)))is from this answer.

function(x,z=rep(c("afilo2679=:","hmpu15'","nstxz","cgr","e","()",'"',","),c(2:5,7,9,15,16)))sum(lengths(regmatches(z,gregexpr(x,z))))

Try it online!

Post Undeleted by JayCe
added 94 characters in body
Source Link
JayCe
  • 3k
  • 13
  • 17

R, 130135 bytes

Previous version wasversions were broken. Thanks to @Giuseppe who pointed wasfor pointing out that paste was not required also saved 2318 bytes or so.lengths(regmatches(z,gregexpr(x,z)))is from this answer .

function(x,z=rep(c("afilmou5679="afilo2679=:","hps12'""hmpu15'","ntxz""nstxz","cgr","e","()","'"',",'"'"),c(2:5,7,9,1615,2116)))sum(lengths(regmatches(z,gregexpr(x,z))))

Try it online! Try it online!

R, 130 bytes

Previous version was broken. Thanks to @Giuseppe who pointed was paste was not required also saved 23 bytes.

function(x,z=rep(c("afilmou5679=:","hps12'","ntxz","cgr","e","()",",",'"'),c(2:5,7,9,16,21)))lengths(regmatches(z,gregexpr(x,z)))

Try it online!

R, 135 bytes

Previous versions were broken. Thanks to @Giuseppe for pointing out that paste was not required also saved 18 bytes or so.lengths(regmatches(z,gregexpr(x,z)))is from this answer .

function(x,z=rep(c("afilo2679=:","hmpu15'","nstxz","cgr","e","()",'"',","),c(2:5,7,9,15,16)))sum(lengths(regmatches(z,gregexpr(x,z))))

Try it online!

Post Deleted by JayCe
added 164 characters in body
Source Link
JayCe
  • 3k
  • 13
  • 17

R, 151130 bytes

Previous version was broken. Thanks to @Giuseppe who pointed was paste was not required also saved 23 bytes.

function(x,z=paste0(repz=rep(c("fu1i059m","2o=h'","1nxzal""afilmou5679=:","tpsrg""hps12'","c""ntxz","""cgr","""e","e"()",",",'"'),c(2:5,7,9,1516,21)),collapse=""))lengths(regmatches(z,gregexpr(x,z)))

Try it online! Try it online!

R, 151 bytes

function(x,z=paste0(rep(c("fu1i059m","2o=h'","1nxzal","tpsrg","c","","","e()",",",'"'),c(2:9,15,21)),collapse=""))lengths(regmatches(z,gregexpr(x,z)))

Try it online!

R, 130 bytes

Previous version was broken. Thanks to @Giuseppe who pointed was paste was not required also saved 23 bytes.

function(x,z=rep(c("afilmou5679=:","hps12'","ntxz","cgr","e","()",",",'"'),c(2:5,7,9,16,21)))lengths(regmatches(z,gregexpr(x,z)))

Try it online!

fixed issue with numbers
Source Link
JayCe
  • 3k
  • 13
  • 17
Loading
Source Link
JayCe
  • 3k
  • 13
  • 17
Loading

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