Find First Repeated Character

easy
1. You are given a String S. 2. You have to find the first repeated character in it, i.e. you need to find the character that occurs more than once and whose index of second occurrence is smallest. 3. main takes input String S from the users. 4. This is a functional problem. 5. You have to complete the solve function. It takes as input the String S. It should return the first repeated character with smallest second occurrence index. If no such character, it should return the character '$'. 6. Don't change the code of main.

Input Format

First line takes input S. Input is handled for you.

Output Format

Repeated character whose first occurrence index is smallest if present, else $ Output is handled for you.

Constraints

N/A

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
ilovepepcoding
Output
e
Previous
Equal Zero One And Two
Next
Find Pairs With Given Relation

Related Questions