Answers

2016-05-04T20:49:40+05:30
Import java.util.*;
class String
{
static void main(String[] args)
{
Scanner sn = new Scanner(System.in);
System.out.print("Enter a sentence: ");
String s = sn.nextLine();
s=s+" ";
int len = s.length();
int p=0;
for(int i=0;i<=len-1;i++)
{
char ch = s.charAt(i);
if(ch==' ')
{
String s1 = s.subString(p,i);
p=i+1;
char a = s1.charAt(2)+ ' ';
}
if(i%2==0)
{
System.out.print("Letter at  even place:" + ch);
}
}
System.out.print("3 letter of each word: " + a);
System.out.print("Sentence entered: "+ s);
}
}
0