Computer Science, asked by hil1, 1 year ago

accept a sentence and print the words that begin and end with the same letter

Answers

Answered by dishasatija
1
i can't understood ur question properly

Answered by chaitanyakrishn1
4
Import java .util.Scanner;
Class letters
{
Public static  void main (String args [])
{
Scanner in =new Scanner (System.in);
System.out.println ("enter a sentence");
String s=in.nextLine ();
s=s+" ";
Int l =s.length ();
String z=" ";
for (int m=0; m <l; m++)
{
char c=s.charAt (m);
If (c!=32)
z=z+c;
Else
{
Int l2= z.length ();
Char c3=z.charAt (0);
Char c4=z.charAt (l2-1);
If (c3==c4)
System.out.println (z);
z=" ";
}
}
}
}
Similar questions