Horje
first none duplicated char Code Example
first none duplicated char
import java.util.Scanner;

public class FirstDuplicate
{
    private static Scanner scanner = new Scanner(System.in);
    public static void main(String[] args)
    {
        System.out.println("Enter random chars");
        String s = new String(scanner.nextLine());
        findTheFirstDublicate(s);

    }
    private static boolean findTheFirstDublicate(String s)
    {
        int[] arr = new int[26];

        for(int i=0 ; i<s.length() ; ++i)
        {
          int c =  s.charAt(i)-'a';
          ++arr[c];
        }
        pint(arr);
        return false;
    }

    private static void pint(int[] arr){
        int i = 0 ;
        while(i < arr.length){
            if(arr[i] == 1){
                System.out.println("First none duplicated letters "+((char)(i+'a')));
            }
            ++i;
        }
    }
}




Java

Related
android volley benefits Code Example android volley benefits Code Example
clear method does not work selenium java Code Example clear method does not work selenium java Code Example
create and populate list one line java Code Example create and populate list one line java Code Example
java treeset sort Code Example java treeset sort Code Example
how to convert string  hashcode to color in java android Code Example how to convert string hashcode to color in java android Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10