| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
someone to help me with my codei don't undestand why is wrong answer with my code .. please..
someome tell me where is the mistake in my code ... here is my code
program p3650; {--The Seven Percent Solution--}
{--procedimiento--}
procedure p_insertar(var palabra:string;var i,tam:integer);
var
aux1,aux:string;
begin
if i=tam then aux:=''
else aux:=copy(palabra,i+1,tam);
aux1:=copy(palabra,1,i-1);
if palabra[i] ='%' then palabra:=aux1+'%25'+aux else
begin
if palabra[i] ='!' then palabra:=aux1+'%21'+aux;
if palabra[i] ='$' then palabra:=aux1+'%24'+aux;
if palabra[i] =' ' then palabra:=aux1+'%20'+aux;
if palabra[i] ='(' then palabra:=aux1+'%28'+aux;
if palabra[i] =')' then palabra:=aux1+'%29'+aux;
if palabra[i] ='*' then palabra:=aux1+'%2a'+aux;
end;
end;
{---principal----}
var
palabra:String;
i,tam:Integer;
begin
repeat
readln(palabra);
if palabra <>'#' then begin
tam:=length(palabra);
i:=1;
while i<= tam do begin
if palabra[i] in [' ','!','$','%','(',')','*'] then begin
p_insertar(palabra,i,tam);
i:=i+1;
tam:=tam+3;
end;
i:=i+1;
end;
writeln(palabra);
end;
until palabra='#';
end.
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator