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))))
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))))
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))))
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))))
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)))
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))))
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)))
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)))
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)))