Find the first non-repeated character
Return the first ASCII character appearing exactly once, or the empty string if none exists. Inputs are valid JSON and must not be modified unless the algorithm uses a local copy. This exercise probes typed data modeling, boundary handling, and algorithm selection.
Input
One JSON value: string. See the sample for its exact shape.
Output
One compact JSON value of type string. Strings include JSON quotes; arrays preserve the specified order.
Constraints
Array/string lengths are 0 to 10000 unless stated otherwise. Numbers are integers in [-1000000,1000000]; all computed results fit the safe integer range.
Example
Input
"swiss"
Output
"w"
Example 2 input
" a"
Output
"a"
Checks a boundary or contrasting case beyond the public examples.
Public test cases (2)
Input
"swiss"
Expected output
"w"
Input
"aabb"
Expected output
""
Hints (2)
- Start with the required output order and the empty-input behavior.
- Count characters, then scan in original order
Target complexity: time O(n) · space O(n)
