← Back to topics
Topic

woweles

d
dario-dsa
Whats wrong whit my code:
var es,b:string;
uk,i,a:integer;
begin
readln(a);
readln(es);
for i:=1 to length(es) do
begin
b:=copy(es,i,1);
if (b=('a')) or (b=('e')) or (b=('i')) or (b=('o')) or (b=('u')) then uk:=uk+1;
end;
writeln(uk);
readln;
end.
b
boris4
i'm not really sure... maybe it is because string in pascal can have at most 255 letters .. so try to read n, and then instead of b = copy( es, i, 1 ) try to read new char. read( b );

so your code should look like:

readln( n );
for i := 1 to n do
begin
read( b );
.
.
.
end;