Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class ExDod {
- static Scanner reader = new Scanner(System.in);
- public static void main(String[] args)
- {
- boolean check=true;
- String beta="", alpha;
- System.out.println("Enter a sentence");
- alpha = reader.next();
- int p=0;
- for(int i=0; i<p; i=i+p)
- {
- p = alpha.indexOf(" ",p+1);
- if(alpha.charAt(i)!= alpha.charAt(i+p))
- check=false;
- if(check)
- beta = alpha.substring(i, p)+" ";
- check=true;
- }
- System.out.println("Beta");
Add Comment
Please, Sign In to add comment