g | x | w | all
Bytes Lang Time Link
057# Kotlin241127T040731ZJoon Yor
016Haskell + hgl241029T154525ZWheat Wi
015Uiua241010T205921Znoodle p
037AWK241028T164519Zxrs
013iogii241031T012712ZDarren S
019K ngn/k241029T114544Zgurditsb
073PHP241012T155608ZLucianDe
014Uiua241014T235914ZjanMakos
240Javascript241013T152856Zjdt
055C gcc241011T171507Zjdt
060Racket241013T171411Zmehbark
012Pyth241012T210357ZMr. Xcod
028Zsh241012T004325ZGammaFun
019J241011T231409Zsouth
034Haskell241011T215806ZAntonio
020Perl 5 p0241010T220238ZXcali
013Retina 0.8.2241010T214755ZNeil
056Google Sheets241011T142125Zz..
014Japt mx241010T190412ZShaggy
050C# .NET Core241011T132545ZMayube
033Bash+coreutils241011T122320ZThemooni
011Vyxal 3.3.0 d241010T212338Znoodle p
069Red241011T075757ZGalen Iv
01305AB1E241011T070533ZKevin Cr
043R241010T194550Zpajonk
037Python 3241011T002308ZLucenapo
017APLDyalog Unicode241011T020029Zakamayu
120Dart241011T010232ZRedz
041Arturo241010T233903Zchunes
014Vyxal241010T215945Zemanresu
014Charcoal241010T214553ZNeil
044JavaScript V8241010T202154Zdoubleun
045Google Sheets241010T193521Zdoubleun
029APL+WIN241010T193010ZGraham
013Jelly241010T192113ZJonathan
049JavaScript ES6241010T192724ZArnauld
015MATL241010T190850ZLuis Men
050JavaScript Node.js241010T184724Zl4m2

# Kotlin, 57 bytes

val f={s:String->"ij.;!?::".map{c->s.count{it==c}}.sum()}

Try it online!

Or if you don't count bytes for lambda declarations:

Kotlin 1.3 or older, 44 bytes

{s->"ij.;!?::".map{c->s.count{it==c}}.sum()}

Try it online!

Where val f:(String)->Int= is the header.

Kotlin 1.4+, 40 bytes

{s->"ij.;!?::".sumOf{c->s.count{it==c}}}

Online Test

Again, val f:(String)->Int= as the header.

sumOf was introduced in Kotlin 1.4+

Haskell + hgl, 16 bytes

mF$fce"ij.;?!::"

Attempt This Online!

Explanation

Counts the number of times each character in the string occurs in the string ij.;?!:: and sums them.

Reflection

Very simple answer, so can't expect much in the way of improvements to hgl. However I do think it could potentially be useful to have mF<fce (equivalently cnT<eqo) as a built in function. This essentially counts the number of equal pairs between two lists, and is extremely similar to how ca already works.

Uiua, 18 15 bytes

/+♭⊞="ij.::;!?"

Try it: Uiua pad

Explanation: Sum of the flattened equality table of the input with "ij.::;!?".

AWK, 59 48 37 bytes

$0=gsub(/[ij\.;!\?]/,x)+2*gsub(/:/,x)

$0=                     # set output to
gsub(/[ij\.;!\?]/,x)    # get count of subs
+2*gsub(/:/,x)          # 2 for colon

Try it online!

awk -F '' '{for(;++i<=NF;x+=$i~/:/)x+=$i~/[ij\.;!\?:]/}$0=x'

BEGIN{FS=X}{for(;++i<=NF;x+=$i~/:/)x+=$i~/[ij\.;!\?:]/}$0=x

awk -F ''             # split characters
{for(;++i<=NF;        # for each character
x+=$i~/:/)            # add one for the colon
x+=$i~/[ij\.;!\?:]/}  # add one if it matches 
$0=x                  # print

iogii, 13 bytes

rq__"ij.;!?::

run it here!!

Repeat the input so that the following eQual check is essentially a cartesian product instead of element by element, then sum and sum again.

The string of dot characters is placed at the end so it can be unterminated, it becomes the left arg to equal using iogii's rotation trick.

K (ngn/k), 19 bytes

+//"ij.;!?::"=\:

Try it online!

PHP, 98 74 73 bytes

$f=fn($i)=>preg_replace(['/:/','/[ij.;!?]/'],['.'],$i,-1,$c)!==null?$c:0;

Try it online!

PHP, 87 bytes

$f=fn($i)=>str_replace(str_split('ij.;!?'),'',str_replace(':','..',$i),$c)!==null?$c:0;

Try it online!

Replacing : with .. inspired from @GammaFunction.

Note: in case of null return from replacement, maybe we should use 'N/A' instead of 0 for preg_replace;

Uiua, 14 bytes

⧻⊚⊞="ij.;!?::"

Try it online!

Explanation

Javascript - 290 242 240 bytes

Counting the dots on a canvas.

s=>[...s].map(a=>{for(x=document.createElement`canvas`.getContext`2d`,x.font="40Q A",x.fillText(a,10,50),d=x.getImageData(i=0,0,99,99).data;++i<1e4;)t+=d[j=i*4+3]>9&&g(j,p=0)<25},t=0,g=i=>d[i]?g(i+4,p++,d[i]=0,g(i-4),g(i+396),g(i-396)):p)|t

JSFiddle

C (gcc), 64 56 55 bytes

f(int*a){a=*a?(*a-58?!!index("ij.;!?",*a):2)+f(++a):0;}

Try it online!

Racket, 60 bytes

(λ(s'(curryr regexp-match* s)`length)(+`'"[ij.;!?:]"`'":"))

Takes a string and runs a regexp twice, nothing fancy, but I'm pleased with the garble of symbols. Heavily relies on default arguments, which write and some formatting elucidates:

(λ (s [quote (curryr regexp-match* s)] [quasiquote length])
  (+ (quasiquote (quote "[ij.;!?:]")) (quasiquote (quote ":"))))

Try it online!

Pyth, 12 bytes

sm/"ij.::;!?

Try it online!

Zsh, 28 bytes

<<<${#${1//:/..}//[^ij;.!?]}

Try it online!

Replace : with .., then remove all non-dot characters and print the string length

J, 19 bytes

1#.1#.'ij.::;!?'=/]

Works the same as most.

Attempt This Online!

1#.1#.'ij.::;!?'=/]
                  ]   NB. input string
      'ij.::;!?'      NB. string literal
                =/    NB. equality table
   1#.                NB. sum rows
1#.                   NB. sum resulting list

Haskell, 34 bytes

f x=sum[1|c<-x,v<-"ij.;!?::",c==v]

Try it online!

Perl 5 -p0, 20 bytes

$_=y/ij.;!?://+y/://

Try it online!

Retina 0.8.2, 14 13 bytes

:
..
[!.;?ij]

Try it online! Link includes test cases. Explanation: :s are "rotated", then the relevant characters are counted which produces the desired result. Edit: Saved 1 byte thanks to @m90.

Google Sheets, 56 bytes

=LEN(REGEXREPLACE(SUBSTITUTE(A1,":","ii"),"[^ij.;!?]",))

Japt -mx, 17 16 15 14 bytes

This could be 12 bytes in v2 but there seems to be a bug with S.è(x) that only counts a maximum of 1 occurrence of x.

Takes input as an array of characters.

"!.::;?ij"oU Ê

Try it

"..."oU Ê     :Implicit map of each U in the input array
"..."         :The necessary characters, with : duplicated
     oU       :Keep only those characters that appear in U
        Ê     :Length
              :Implicit output of sum of resulting array

C# (.NET Core), 50 bytes

s=>Regex.Replace(s,"(:)|[^!?;:.ij]","$1$1").Length

Try it online!

I tried to find a shorter/more interesting solution but the regex approach works really well.

Bash+coreutils, 33 bytes

tr -cd ij.\;!?<<<${1//:/..}|wc -c

Attempt This Online!

Is also optimal for zsh, I think.

explanation:

                 ${1//:/..} #replace all : with .. in first argument
              <<<           #and pass it to standard input of...
tr -cd ij.\;!?              # from stdin, output only characters specified to stdout
                           |wc -c # pass stdout to stdin of: count chars in stdin
#implicit output stdout to terminal

Vyxal 3.3.0 d, 11 bytes

ᵒ="ij.::;!?

Try it Online!

I downgraded to Vyxal 3.3.0 because that's the most recent version which still supports Nilad moving, a feature which was removed because it makes debugging super annoying but makes this program a byte shorter because it lets me move the string to the end of the line instead of having it at the front, saving a byte on the closing quotation mark.

The logic is super simple: Take the outer product of equality with the string ij.::;!?, and d deeply sums the result.

Red, 69 bytes

func[s][n: 0 foreach c s[n: n + case[find"ij.;!?"c 1 c =#":"2 1 0]]n]

Try it online!

05AB1E, 13 bytes

"!.::;?ij"S¢O

Try it online or verify all test cases.

Explanation:

"!.::;?ij"    # Push this string (note the "::")
          S   # Convert it to a list of characters
           ¢  # Count each of those characters in the (implicit) input-string
            O # Sum the counts together
              # (after which the result is output implicitly)

Unfortunately, the shortest compressed version of this character-list I could find is 1 byte longer: •м€2Q¸Ü•žQÅв¢O. Also, there are some minor variations possible for the same byte-count: ":!.;?ij"Ć€¢O or "!.;?ij:"¤ª¢O.

R, 43 bytes

\(s)nchar(gsub("(:)|[^ij.;!?]","\\1\\1",s))

Attempt This Online!

Port of @doubleunary's Google Sheets answer.


R, 48 44 bytes

Edit: -4 bytes porting @Luis Mendo's MATL answer.

\(s)sum(outer(utf8ToInt("ij.;!?::"),s,`==`))

Attempt This Online!

Takes input as a vector of character codes.

Python 3, 42 37 bytes

lambda a:sum(map(a.count,'ij.;!?::'))

Try it online!

APL(Dyalog Unicode), 17 bytes SBCS

A 2 train that counts set bits in the equality table between input and string ::ij.;!?.

≢∘⍸∘.=∘'::ij.;!?'

Try it on APLgolf!

Dart, 120 bytes

main(List<String>y,{i=0,j=0,x}){x=y[0];for(;i<x.length;i++){if('ij.;!?'.contains(x[i]))j++;if(x[i]==':')j+=2;}print(j);}

Try it online!

Only takes one string at a time.

Arturo, 41 bytes

$=>[replace&":"{..}|match"[ij.;!?]"|size]

Try it!

Vyxal, 14 bytes

`ij.::;!?`fvO∑

Try it Online!

            O  # Count in input
          fv   # Each of
`ij.::;!?`     # String "ij.::;!?"
             ∑ # sum counts

Charcoal, 14 bytes

IΣE!.::;?ij№θι

Try it online! Link is to verbose version of code. Explanation:

   !.::;?ij     Literal string `!.::;?ij`
  E             Map over characters
           №    Count of
             ι  Current character
            θ   In input string
 Σ              Take the sum
I               Cast to string
                Implicitly print

JavaScript (V8), 44 bytes

t=>t.replace(/(:)|[^ij.;!?]/g,'$1$1').length

Try it online!

Port of my Google Sheets answer.

(-1 thanks to emanresu A)

Google Sheets, 45 bytes

=len(regexreplace(A1,"(:)|[^ij.;!?]","$1$1"))

Put the text string in cell A1 and the formula in cell B1.

screenshot

(-1 thanks to emanresu A)

APL+WIN, 29 bytes

Prompts for string:

(+/s∊'ij.;!?.')+2×+/(s←⎕)∊':'

Try it online! Thanks to Dyalog Classic

Jelly,  14  13 bytes

ċⱮ“::ij.;!?”S

A monadic Link that accepts a list of characters and yields the number of dots.

Try it online!

How?

ċⱮ“::ij.;!?”S - Link: list of characters, T
  “::ij.;!?”  - list of characters -> "::ij.;!?"
 Ɱ            - map with:
ċ             -   {T} count {char}
            S - sum

JavaScript (ES6), 49 bytes

Expects an array of characters.

a=>a.map(c=>t+=c==":"?2:/[ij.;!?]/.test(c),t=0)|t

Try it online!

MATL, 15 bytes

0h'ij.;!?::'!=z

Try it online! Or verify all test cases.

How it works

0h         % Implicit input. Attach character 0. This is needed to avoid empty string
'ij.;!?::' % Push this string. Note that ':' appears twice
!          % Transpose into a column vector
=          % Matrix of all pair-wise comparisons
z          % Number of non-zeros. Implicit display

JavaScript (Node.js), 50 bytes

x=>[...'ij.;!?::'].flatMap(c=>x.split(c)).length-8

Try it online!