CS 1620 Assignment #7 Fall 2000

How to handin.
Points : 40
Due : Monday Nov 20, 2000 @ midnight
Note : Late assignments will be accepted only with the instructor's pre-approval.
Marks will be awarded for comments, style, readability, compiling and working correctly.
  1. [10]Page 423 Programming Project #8

  2. [10]Page 423 Programming Project #9. A sample dictionary file diction.txt can be copied from $L/diction.txt to your own directory.

  3. [10]Given two strings A and B, find the longest common substring. A substring of a string is a consecutive sequence of characters.

    For example :

    A = abaabababbabababbababaa
    B = abaababbababaa

    The longest common substring is : ababbababaa

  4. [10] Write a program which will read lines from a data file amd print each sentence of the file to an output file with each sentence on a separate line preceeded by the number of words in that sentence. Also print the total number of sentences to the screen after all lines of the file have been read and processed. We shall assume that a sentence ends with a period, question mark, or exclamation mark and that periods are not used for any other reason.

    For example if the input file is :

    This is a test file. I think
    that it is very good. Do you? I
    hope that you do. Great!

    Then the output file would be :

    5 This is a test file.
    7 I think that it is very good.
    2 Do you?
    5 I hope that you do.
    1 Great!

    And to the screen would be written:

    The file has 5 sentences.


Assignment List | Next | Prev | Computer Science 1620
Department of Mathematics & Computer Science
University of Lethbridge Home Page