Single Occurrence

Published by Deep Xavier in

Create a function that, given a string str, finds a letter that has occurred only once. Return the letter in uppercase. If the input is empty, return an empty string "".

Examples

singleOccurrence("TeEsShHAa") ➞ "T"

singleOccurrence("LoOOvvVEEssS") ➞ "L"

singleOccurrence("DeEPp") ➞ "D"

singleOccurrence("EFFEAABbc") ➞ "C"

singleOccurrence("AAAAVNNNNSS") ➞ "V"

singleOccurrence("S") ➞ "S"

Notes

The function will be case insensitive.

Watch a quick demo on how Edabit works.