Pages

Tuesday, July 3, 2012

program that detects successive repeated occurrence of a letter in a word in java

Write a program that detects successive repeated occurrence of a letter in a word. For example, in the word “explanation” letter ‘a’ and ‘n’ occurs twice.





class occurance

{

public static void main(String args[])

{

String a;

String[] Arr;

Arr = new String[20];



int f=0,len;

len=args[0].length();



String str=args[0];

System.out.println(str);





for(int i=0;i
{

Arr[i]=str.substring(i,i+1);

System.out.println(Arr[i]);

}





}

}

No comments:

Post a Comment