Guest User

Untitled

a guest
Aug 10th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. import java.util.*;
  2. public class ExDod {
  3.  
  4.     static Scanner reader = new Scanner(System.in);
  5.     public static void main(String[] args)
  6.     {
  7.     boolean check=true;
  8.     String beta="", alpha;
  9.     System.out.println("Enter a sentence");
  10.     alpha = reader.next();
  11.     int p=0;
  12.     for(int i=0; i<p; i=i+p)
  13.     {
  14.         p = alpha.indexOf(" ",p+1);
  15.             if(alpha.charAt(i)!= alpha.charAt(i+p))
  16.                 check=false;
  17.             if(check)
  18.                 beta = alpha.substring(i, p)+" ";
  19.             check=true;
  20.                
  21.     }
  22.    
  23.     System.out.println("Beta");
Add Comment
Please, Sign In to add comment