@@ -0,0 +1,1289 @@
+package com.sunny.grokkingalgorithms.gfg.ggl;%0A%0Aimport java.util.*;%0A%0A/**%0A * Created by sundas on 4/23/2018.%0A */%0Apublic class FindSecondNonRepeatedCharInString %7B%0A%0A%0A  /*%0A  Find second non repeated char ins tring.%0A   */%0A%0A  /**%0A   *%0A   * @param str%0A   * @return%0A   */%0A  public static char findSecondNonRepeatedCharInString(String str)%7B%0A    char secondNonRepeatedChar = '%5C0';%0A    Map%3CCharacter,Integer%3E tracker = new LinkedHashMap%3C%3E();%0A    for(int i = 1 ; i %3C str.length(); i++)%7B%0A      char current = str.charAt(i);%0A      if(tracker.containsKey(current))%7B%0A        tracker.put(current,tracker.get(current) + 1);%0A      %7D%0A      else%7B%0A        tracker.put(current,1);%0A      %7D%0A    %7D%0A    Iterator%3CMap.Entry%3CCharacter,Integer%3E%3E iterator = tracker.entrySet().iterator();%0A    boolean first = false;%0A    while(iterator.hasNext())%7B%0A      Map.Entry%3CCharacter,Integer%3E entry = iterator.next();%0A      if(entry.getValue() == 1)%7B%0A        if(!first)%7B%0A          first = true;%0A        %7D%0A        else%7B%0A          secondNonRepeatedChar = entry.getKey();%0A        %7D%0A      %7D%0A    %7D%0A    return secondNonRepeatedChar;%0A  %7D%0A%0A  /**%0A   *%0A   * @param args%0A   */%0A  public static void main(String%5B%5D args) %7B%0A    String str = new String(%22aaaaacbbbbbdaaaabbb%22);%0A    System.out.println(findSecondNonRepeatedCharInString(str));%0A  %7D%0A%0A%0A%7D%0A

Find second non repeated character ina string.