Find Duplicate Words in a Sentence
Easy
Given a sentence, write an Appian expression rule that identifies and returns all words that appear more than once in the sentence. The comparison should be case-insensitive.
Example :
Input: "Appian is powerful and Appian is easy"
Output: {"appian", "is"}
ri! Rule Inputs
ri!sentenceText"Test is a test which contains test cases"
Example 1 — Case 1
Input: ri!sentence
"A big buck bucket over the big bug bucket"
Output:
{
"big",
"bucket"
}Example 2 — Case 2
Input: ri!sentence
"Appian is great and appian is powerful"
Output:
{
"appian",
"is"
}Example 3 — Case 3
Input: ri!sentence
"Hello world"
Output:
{}Example 4 — Case 4
Input: ri!sentence
"Test test TEST testing"
Output:
{"test"}Appian Expression Tips
- • Use
ri!variableNamefor rule inputs - • Use
a!localVariables(local!x: …, body)for locals - • Use
a!forEach(items: …, expression: fv!item)to iterate - • Use
where()/reject(fn!isnull, list)to filter