Find Duplicate Characters in a String | Java Code

Given an input string, Write a java code to find duplicate characters in a String.

For example :

Example 1:

Input    : “Java”
Output : a

The character a appears more than once in a string.

Example 2:

Input : “programming”
Output : m,g,r

These three characters (m, g, r) appears more than once in a string.

Find First Non-repeating Character in a String – Java Code

Write a java program to find first non-repeating character in a string. Given an input string, Write a java code to find first non-repeating character in a string.

For example –

i) Input string – java
Output – j (j is the first non-repeating character)

ii) Input string – web rewrite
Output – b (b is the first non-repeating character)