You are on page 1of 2

S inverzno

program kontrolni;
var s:string;
I:integer;
begin
writeln('unesi string');
readln(s);
for i:=length(s) downto 1 do
write(s[i]);
read(s);
end.

Koliko znak u s
program kontrolni;
var s:string;
i,p:integer;
x:char;
begin
writeln('unesi string');
readln(s);
writeln('unesi znak');
read(x);
p:=0;
for i:= 1 to length(s) do
if x = s[i] then p:=p+1;
writeln ('pojavio se ',p,' puta');
end.

Kolko reci u s
program kontrolni;
var s:string;
k,i:integer;
begin
writeln('unesi string');
readln(s);
k:=1;
for i:=1 to length(s) do
if s[i]=' ' then k:=k+1;
writeln('imamo ', k,' reci u stringu');
end.

Po abecedi
program kontrolni;
var pom:string;
s:array[1..30] of string;
j,i,n:integer;

begin
writeln('unesi broj ucenika');
readln(n);
for i:=1 to n do
begin
writeln('unesi prezime');
readln(s[i]);
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if s[i] > s[j] then
begin
pom:=s[i];
s[i]:=s[j];
s[j]:=pom;
end;
for i:=1 to n do
writeln(s[i]);
end.
10 vrsti
program kontrolni;
var s:string;
p,i:integer;
begin
writeln('unesi string');
readln(s);
for i:= 1 to length(s) do
begin
write(s[i]);
p:=p+1;
if p mod 10 =0 then writeln;
end;
end.

program kontrolni;
var s:string;
p,i,k,m:integer;
begin
writeln('unesi string');
readln(s);
p:=0;
k:=0;
m:=0;
for i:=1 to length(s) do
begin
if s[i]='+' then p:=p+1;
if s[i]='-' then k:=k+1;
if s[i]='*' then m:=m+1;
end;
writeln('plus se pojavi', p);
writeln('minus se pojavio', k);
writeln('zvezdica se pojavila', m);
end.

program kontrolni;
var s:string;
I:integer;
begin
writeln('unesi string');
readln(s);
for I:=1 to length(s) do
begin
write(s[i]);
if s[i]='.' then writeln;
if s[i]=',' then writeln;
if s[i]='!' then writeln;
if s[i]='?' then writeln;
end;
end.

Rate