Program Occurrence_mot ;
Var ch, mot : string;
nb, i, k: integer;
Begin
Repeat
Writeln ('saisir un texte');
Readln (ch);
Until
length (ch)>20;
Writeln ('saisir un mot');
Readln (mot);
k:=length (mot); nb:=0; i:=1;
Repeat
If (ch[i] = mot[1]) and (mot = copy (ch, i, k)) Then
Begin
nb:=nb+1;
i:=i+k;
End
Else
i:=i+1;
Until i>length(ch);
Writeln (mot, ' figure dans le texte ', nb, ' fois');
End.
UHJvZ3JhbSBPY2N1cnJlbmNlX21vdCA7ClZhciBjaCwgbW90IDogc3RyaW5nOwpuYiwgaSwgazogaW50ZWdlcjsKQmVnaW4KUmVwZWF0CldyaXRlbG4gKCdzYWlzaXIgdW4gdGV4dGUnKTsKUmVhZGxuIChjaCk7ClVudGlsCmxlbmd0aCAoY2gpPjIwOwpXcml0ZWxuICgnc2Fpc2lyIHVuIG1vdCcpOwpSZWFkbG4gKG1vdCk7Cms6PWxlbmd0aCAobW90KTsgbmI6PTA7IGk6PTE7ClJlcGVhdApJZiAoY2hbaV0gPSBtb3RbMV0pIGFuZCAobW90ID0gY29weSAoY2gsIGksIGspKSBUaGVuCkJlZ2luCm5iOj1uYisxOwppOj1pK2s7CkVuZApFbHNlCmk6PWkrMTsKVW50aWwgaT5sZW5ndGgoY2gpOwpXcml0ZWxuIChtb3QsICcgZmlndXJlIGRhbnMgbGUgdGV4dGUgJywgbmIsICcgZm9pcycpOwpFbmQu