Answer Posted / adarsh
Scanner sc=new Scanner(system.in);
Int i,j=0;
String S1=sc.next(),s2;
S2=s1charAt(0);
For(i=1;i<s1.length;i++)
{
If(s2.charAt(j).equals (s1.charAt(i))
Continue;
Else{
S2=s2.concat(s1.charAt(i));
j++;
}
}
Sop(j);
}
I m writing with my mobile phone so chuck the mistakes like upercase nd lowr case...
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is the difference between the file and randomaccessfile classes?
Explain some best practices you would apply while using collection in java?
What is the definition of tree ?
Why put method is used?
What exceptions occur during serialization?
Why there is no call by reference in java?
What is break and continue statement?
What does sizeof return?
What is the difference in between cpp and java? Can u explain in detail?
Can we serialize singleton class?
what is synchronization and why is it important? : Java thread
Why is singleton instance static?
What is the method overriding?
What is difference between checked and unchecked exception in java?
What is a buffer in java?