Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program WordCounter;
- var
- txt, word:string;
- i, count:integer;
- begin
- write('Input text >> ');
- readln(txt);
- write('Input word >> ');
- readln(word);
- count := 0;
- for i := 1 to length(txt) do if(copy(txt, i, length(word)) = word) then inc(count);
- writeln('The number of the words "', word, '" is ', count, '.');
- end.
Add Comment
Please, Sign In to add comment