insidcode
ProblemsDuelLeaderboardStats
Sign In
  1. Home
  2. Problems
  3. Find the first non-repeating character in a string in a single traversal using a frequency counter.

Find the first non-repeating character in a string in a single traversal using a frequency counter.

Difficulty: Medium

Phase: 6 · Mixed Logical Challenges

XP Reward: 20 XP

Topics: Mixed Logical Challenges, Medium

Supported Languages: Python, JavaScript, C, C++, Java

Problem Description

Given string S, find first non-repeating character in a single traversal. If none, print -1. Input Format: Read input from standard input (stdin). Output Format: Print the result to standard output (stdout).

Constraints

  • -10^9 <= N <= 10^9

Examples

Example 1

Input: swiss

Output: w

Explanation: Sample execution for input swiss