Question

Give the count of each word

Input: "Hello, test string, test"

Output: Hello - 1

test - 2

string - 1

A
Anonymous
June 3, 2026

Answer

a!localVariables(
local!data : "Hello, test string, test",
local!data1: split(local!data," "),
local!uniqData: union(local!data1,local!data1),
a!forEach(
items: local!uniqData,
expression: fv!item & "-" & count(wherecontains(fv!item,local!data1))
)
)

Output: Hello - 1

test - 2

string - 1

JuniorExpressions#coding
Loading comments...