find first repeating letter in a string

print first repeated element



  1. public class Array2 {

  2. public static void main(String[] args) {
  3. /*String s="ffaghglklklh";
  4. Outer:for(int i=0;i<s.length();i++){
  5. Innter: for(int j=i+1;j<s.length();j++){
  6. if(s.charAt(i)==s.charAt(j)){
  7. System.out.println(s.charAt(i));
  8. break Outer;
  9. }
  10. }
  11. }*/
  12. int[] arr={1,2,3,4,5,0,0,1,3};
  13. Outer:for(int i=0;i<arr.length;i++){
  14. Innter: for(int j=i+1;j<arr.length;j++){
  15. if(arr[i]==arr[j]){
  16. System.out.println(arr[i]);
  17. break Outer;
  18. }
  19. }
  20. }
  21. }

  22. }


                    Comments

                    Popular posts from this blog

                    Today Walkin 14th-Sept

                    Spring Elasticsearch Operations

                    Hibernate Search - Elasticsearch with JSON manipulation