First Non-Repeating Character

JavaScript Medium 4 views
Back to Questions

Problem Description

Given a lowercase string, find the first character that does not repeat. Print the character, or -1 if all repeat.

Input Format

One line string (lowercase).

Output Format

One character or -1.

Sample Test Case

Input:
aabccbd
Output:
d

Constraints

Length up to 2e5.

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next