program 5kata;
{menghitung banyak kata 'kamui' dalam pita karakter}
kamus:
CC,C1,C2: string
count: integer
procedure startcouple;
start;
C1 <- ''
C2 <- CC
procedure advcouple;
adv;
C1 <- C2
C2 <- CC
algoritma:
startcouple;
count <- 0
while CC<>'.' do
begin
if C1='k' and C2='a' then
begin
advcouple;
if C1='m' and C2='u' then
begin
advcouple;
if C1='i' then
begin
count <- count+1
end;
end;
end;
advcouple;
end;
output(count);
{menghitung banyak kata 'kamui' dalam pita karakter}
kamus:
CC,C1,C2: string
count: integer
procedure startcouple;
start;
C1 <- ''
C2 <- CC
procedure advcouple;
adv;
C1 <- C2
C2 <- CC
algoritma:
startcouple;
count <- 0
while CC<>'.' do
begin
if C1='k' and C2='a' then
begin
advcouple;
if C1='m' and C2='u' then
begin
advcouple;
if C1='i' then
begin
count <- count+1
end;
end;
end;
advcouple;
end;
output(count);

0 komentar:
Poskan Komentar