Find first non | C ++ implementation to find the first non - repeating element of the string using Linked List ; Function to find the first non - repeating element of the given string using Linked List ; Driver Code ; Function Call
#include <bits/stdc++.h> NEW_LINE using namespace std ; void firstNonRepElement ( string str ) { map < char , int > mpp ; for ( auto i : str ) { mpp [ i ] ++ ; } for ( auto i : str ) { if ( mpp [ i ] == 1 ) { cout << i << endl ; return ; } } return ; } int main ( ) { string str = " geeksforgeeks " ; firstNonRepElement ( str ) ; }