zax2002

WordCounter [https://otvet.mail.ru/question/206401843]

Feb 5th, 2018
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.36 KB | None | 0 0
  1. program WordCounter;
  2.  
  3. var
  4.     txt, word:string;
  5.     i, count:integer;
  6.  
  7. begin
  8.     write('Input text >> ');
  9.     readln(txt);
  10.     write('Input word >> ');
  11.     readln(word);
  12.    
  13.     count := 0;
  14.     for i := 1 to length(txt) do if(copy(txt, i, length(word)) = word) then inc(count);
  15.    
  16.     writeln('The number of the words "', word, '" is ', count, '.');
  17. end.
Add Comment
Please, Sign In to add comment