JavaScriptEasyStrings10 min

Find the first non-repeated character

Return the first character appearing exactly once, or the empty string if none exists. All input is valid JSON satisfying the constraints; do not mutate the meaning of values through type coercion. Interviewers use this problem to assess count first, then scan in original order.

Input

A JSON string on stdin.

Output

Print one compact JSON value: a string.

Constraints

0 <= string length <= 10000; ASCII characters only.

Example

Input

"swiss"

Output

"w"

Example 2 input

"1123"

Output

"2"

Boundary case: No unique character means an empty string

Public test cases (2)

  • Input

    "swiss"

    Expected output

    "w"
  • Input

    "aabb"

    Expected output

    ""
Hints (2)
  1. Use a Map for character counts
  2. No unique character means an empty string

Target complexity: time O(n) · space O(n)

Your solution

Checking runner availability…

Reference solution

Sign in for solution
All JavaScript programs