Java program for finding double letter sequence word in Java
Double-letter words:
These are the words which contain atleast one set of characters used twice consecutively.
For example:
add,all, bee, boo, ebb, ell, egg, fee, goo, tee, too, see.
import java.util.*;
class DoubleSequenceWord{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
System.out.println("enter a word to check whether it is double sequence or not");
String str=sc.nextLine();
int count=0;
for(int i=0;i<str.length()-1;i++){
if(str.charAt(i)==str.charAt(i+1)){
count++;
break;
}
}
if(count>0)
System.out.println("It is a double sequence word");
else
System.out.println("It is a not a double sequence word");
}
}
Perfect program for what I have searched for.
ReplyDeleteThanks for this program.
You can also get all details from here: https://codingface.com/find-double-letter-sequence-words-in-java/