Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var
- S, Word: string;
- i, j, LastIndex, WordLen: Integer;
- ShouldWrite: Boolean;
- begin
- Writeln('Enter string:');
- Readln(S);
- i := 1;
- LastIndex := Length(S);
- while S[LastIndex] <> ' ' do
- Dec(LastIndex);
- Writeln('Result: ');
- while i <= LastIndex do
- begin
- WordLen := 0;
- j := i;
- ShouldWrite := True;
- Word := '';
- while S[j] <> ' ' do
- begin
- if Pos(S[j], Word) <> 0 then
- ShouldWrite := False;
- Word := Word + S[j];
- Inc(j);
- Inc(WordLen);
- end;
- if ShouldWrite then
- Write(Word, ' ');
- Inc(i, WordLen + 1);
- end;
- Readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement