|
|
вернуться в форумWA #17 My program read string S from the input and create reverse string R from the source string. Then I search in cycle with prefix function maximum suffix which may be prefix on string S.substr(i, S.length()-i)+R i - the number of the iteration. Then I check if the getting string the palindrome, I remember then offset and length of the string. In the end print maximum substring. Got WA on 17 test. Thanks on the future...:) Re: WA #17 1) First of all, you should compute prefix function on string S.substr(i, S.length()-i)+R.substr(0,S.lenght()-i); 2) add '#' between original string and reverse string: because on test "aaa" correct answer is "aaa" while your programm seems to output "aaaaa". P.S I'm not sure my advices wiil help you,so just write here your mail and i'll send you AC code - my idea is the same with yours but i don't check palindroms - prefix fuction makes by itself! Re: WA #17 Oh, I insert on concatenating between strings (original and reverse) '#' symbol and got AC! Re: WA #17 This test 'abcdesdfssaaaassss' show my Error with Manaker algorithm. |
|
|