I need a program that gives largest distance of occurrence of a given character in a given string.
For example, Given string "my name is samitha" and given a character "a" pgm should output 7.
I tried but got error.
This isn't really a job discussion so I moved it from that forum over to Java in General.
Shreegowri Bhojanna wrote:I tried but got error
You're not going to get a ready made answer here but if you show us what you've tried so far and explain what the current problem is that you are facing then you are more likely to get some constructive help.
You said "I tried but got an error". That doesn't tell us much. There are something like one million ways you could "try and get an error". If we start guessing - i.e. saying "did you do this? how about this? Well, maybe this?", it will take us a LONG time to find the solution to your problem.
so, please post your code. Tell us EXACTLY what happens when you compile and/or run it. Your job is to provide the details and make it as easy as possible for us to help you. I would suggest you read some of our How To Ask Questions FAQ first.
Joined: Feb 13, 2014
k k, I got it.I found out the error, while passing parameter i used String instance instead of BufferedString.
Anyhow thank you for all suggestions next time while posting first i will post my code.
And sorry to all of you.