ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1354. Palindrome. Again Palindrome

WHAT IS WA#4
Posted by Buni_Real 9 Oct 2008 20:50
ADMINSTRATOR
HELP PLEASE !!!!!!!!!!!!
IT'S MY COD
var
    a:array [1..20010] of char;
    i,j,k,n,w:integer;
    r:char;
    s:string;
    f:boolean;
    g:text;
    t:integer;
procedure solve;
label 1;
var e:integer;
begin
     f:=false;
     t:=0;
     for k:=1 to n+i do
     if (a[k]<>a[n+i-k+1]) then goto 1;
     f:=true;
     1:
end;
    {IMPORTANT PART}
Begin
      assign(g,'input.txt');
      reset(g);
      while not eof(g) do
      begin
          readln(g,s);
          n:=0;
          for i:=1 to length(s) do
              begin
                  n:=n+1;
                  a[n]:=s[i];
              end;
              i:=0;
       repeat
                solve;
                if not(f) then
                begin
                     i:=i+1;
                     for j:=n+i downto n+1 do
                       begin
                            a[j]:=a[j-1];
                       end;
                  a[n+1]:=a[i];
                  solve;
                end;
        until f;
    end;
        // close(g);
          for j:=1 to n+i do
               write(a[j]);
               readln;readln;
end.

REAL MADRID LUCK
THE BEST CLUB
WHAT IS WA#4
Posted by Rabidstorm 16 Dec 2008 13:26
Me too!!!
program Ural1354;

var
  s:string;
  a,b,l:longint;

begin
  readln(s);
  l:=length(s);
  a:=1;
  while a<l do
    begin
      if s[a]<>s[l] then
        begin
          s:=s+' ';
          for b:=length(s) downto l+2 do
            s[b]:=s[b-1];
          inc(l);
          s[l]:=s[a];
        end;
      inc(a);dec(l);
    end;
  writeln(s);
end.
Re: WHAT IS WA#4
Posted by Wyand 24 Apr 2010 17:21
You are to find a nonempty word S2
if the input is palindrome...
Re: WHAT IS WA#4
Posted by IgorKoval(from Pskov) 25 Nov 2011 17:57
Test#4
abaabaaba

ans:
abaabaaba    //for WA4, because S2 must be not empty!
abaabaabaaba //for AC

Edited by author 25.11.2011 17:57
Re: WHAT IS WA#4
Posted by Rudolf 25 Nov 2015 02:54
I have the same answer, but still get WA4. What the problem?
Re: WHAT IS WA#4
Posted by GastonFontenla 19 Jan 2016 08:11
That's not the answer my friend. This is correct:

abaabaaba
abaababaaba

As you see, your solution add three characters. Mine add only two. Greetings!
Re: WHAT IS WA#4
Posted by Sandu Petrasco 6 Jun 2016 00:17
nope, you should print S1 S2, as you see in your answer there is not clearly S1