## 2062 WA!!!

Do you want to discuss about these problems? Go now!
Users are shared (no need to re-register).

Moderator: Board moderators

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am

### 2062 WA!!!

Some one plz help me i got WA.

Code: Select all

``removed``
Last edited by Obaida on Sun Jan 11, 2009 12:19 pm, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.

newkid
Learning poster
Posts: 73
Joined: Fri Dec 12, 2008 3:06 am

### Re: 2062 WA!!!

try this input

Code: Select all

``````abc
end``````
my program outputs

Code: Select all

``<abc> is acceptable.``

Code: Select all

``<abc> is not acceptable.``
hope this helps..
hmm..

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am

### Re: 2062 WA!!!

Thank you. But still Wa!!!!

Code: Select all

``removed``
Last edited by Obaida on Mon Jan 12, 2009 6:31 am, edited 1 time in total.
try_try_try_try_&&&_try@try.com
This may be the address of success.

newkid
Learning poster
Posts: 73
Joined: Fri Dec 12, 2008 3:06 am

### Re: 2062 WA!!!

There are several anomalies/bugs in your code.

first of all, the if condition is wrong and should never be written in the way you wrote..

Code: Select all

``if((st[i-1]==st[i-2]&&i>=2)||(st[i-1]==st[i+1]&&i<len-1)){acc = 0;break;}``
it should be..

Code: Select all

``if((i >= 2 && st[i - 1] == st[i - 2]) || (i < len - 1 && st[i - 1] == st[i + 1]))...``
what i want to say is the boundary condition i >= 2 or i < len - 1 must be checked first and then array accessing..

and i think your code will fail in the following input..
bcda

it prints bcda is acceptable but its not..

hope this helps..
hmm..

Obaida
A great helper
Posts: 380
Joined: Wed Jan 16, 2008 6:51 am