Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
First non-repeating character using one traversal of string in C++
In this tutorial, we are going to learn how to find the first non-repeating character in the given string. Let's see an example.
Input −tutorialspoint
Output −u
Let's see the steps to solve the problem.
Initialize the string.
Initialize a map char and array to store the frequency of the characters in the string.
Iterate over the string.
Find the frequency of each character and store them in the map.
Store the index of the character as well.
Iterate over the character frequencies in the map.
Print the first character with the frequency 1.
Example
Let's see the code.
#include#include
Advertisements
