I've been trying to make this work for a while now. I need to make a program for school project that takes a string and counts symmetrical words inside it.
There are supposed to be sentences inside, but anything helps. I can't seem to get it to work no matter what approach I try. Could you help me out?
EDIT: my current code
program rocnik;
var text:string;
word,drow:string[10];
i,j,k,p1:integer;
space,sym:boolean;
begin
p1:=0;
write('Enter text: ');readln(text);
if text<>'' then
begin
for i:=1 to length(text) do
begin
k:=0;
if space then
begin
j:=0;
space:=false;
end;
sym:=true;
if text[i]<>' ' then
begin
j:=j+1;
word[j]:=text[i];
end
else space:=true;
if space then
begin
space:=false;
for j:=1 to length(word) do
begin
k:=k+1;
drow[k]:=word[j];
if drow[k]<>word[j] then sym:=false;
end;
end;
if space and sym then p1:=p1+1;
end;
end
else writeln('You didnt enter any text');
writeln('there are ',p1,' symmetrical words in text');
readln;
end.