Skip to main content
deleted 7 characters in body
Source Link
flodel
  • 2.4k
  • 16
  • 16

R - 6154

sum(sapplynchar(gsub("[^o]","",english::english(1:scan())),nchar))

Unlike the OP, I get 41 when the input is 101for n=101. I hope someone can confirm.

R - 61

sum(sapply(gsub("[^o]","",english::english(1:scan())),nchar))

Unlike the OP, I get 41 when the input is 101. I hope someone can confirm.

R - 54

sum(nchar(gsub("[^o]","",english::english(1:scan()))))

I get 41 for n=101. I hope someone can confirm.

Source Link
flodel
  • 2.4k
  • 16
  • 16

R - 61

sum(sapply(gsub("[^o]","",english::english(1:scan())),nchar))

Unlike the OP, I get 41 when the input is 101. I hope someone can confirm.