Advertisement
SergeyPGUTI

7.2.10

Nov 26th, 2015
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.52 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Main {
  3.  
  4.  
  5.     static char  doubleChar(String a)
  6.     {
  7.         for(int i=0,Length=a.length();i<Length;i++)
  8.         {
  9.             for(int j=i+1;j<Length;j++)
  10.             {
  11.                 if (a.charAt(i)==a.charAt(j) && a.charAt(i)!=' ') return a.charAt(i);
  12.             }
  13.         }
  14.         return '0';
  15.     }
  16.  
  17.     public static void main(String[] args) {
  18.         Scanner in = new Scanner(System.in);
  19.         String a=in.nextLine();
  20.         System.out.print(doubleChar(a));
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement