Question

Given a string, write a program to count the frequency of each word and display the word along with its count.


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...
Given a string, write a program to count the frequency of each… — Expressions | Appian Interview Questions - AppianVerse