Question: You are to write a program that counts the number of letter pairs in a sentence generated by consecutively pairing the letters, excluding the space

 You are to write a program that counts the number of

You are to write a program that counts the number of letter pairs in a sentence generated by consecutively pairing the letters, excluding the space character. For example, given the sentence below, the consecutive pairs are shown. the rain in spain falls mainly on the plains th he ra ai in in sp pa ai in fa al ll ls ma ai in nl ly on th he pi la ai in ns For the above example, the count of pairs are: th 2 ai 4 pa 1 ll 1 n1 1 p1 1 he 2 in 5 fa 1 ls 1 1y 1 la 1 ra 1 sp 1 al 1 ma 1 on 1 ns 1 An example data file is shown below. 9 the rain in spain falls mainly on the plains 5 the country counsels the distance 5 the organization records the committee 6 the ashamed son revises the voice 6 the advertisement trades the responsible son 5 the danger publicizes the story 6 the shake regulates the fine credit 6 the list specifies the fresh powder 5 the shade reasons the night 6 the rain schedules the nauseating lift 5 the degree collates the grass For each sentence in the data file output the sentence and the number of pairs and the sentence in the same order as the data file. For example, the first few lines of output should appear as below. There is an unknown number of various size sentences. the rain in spain falls mainly on the plains th he ra ai in sp pa fa al ll ls ma nl ly on pi la ns 2 2 1 4 5 1 1 1 1 1 1 1 1 1 1 1 1 1 The country counsels the distance th he co ou un nt tr ry ns se el ls di is st ta an nc ce 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 The datafile is located at ~dmk0080/public/1040/labs/examl/wordpairs. Name your program letterpairs.e

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!