Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- static char doubleChar(String a)
- {
- for(int i=0,Length=a.length();i<Length;i++)
- {
- for(int j=i+1;j<Length;j++)
- {
- if (a.charAt(i)==a.charAt(j) && a.charAt(i)!=' ') return a.charAt(i);
- }
- }
- return '0';
- }
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- String a=in.nextLine();
- System.out.print(doubleChar(a));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement