Question: Help me write a code that would read an input file ( somefile.txt ) with lines of tokens (words) separated by a -. How do

Help me write a code that would read an input file (somefile.txt) with lines of tokens (words) separated by a "-". How do i print the words by using split() functions and making each as a separate string. The output has to have a ( ) between each word.(example shown below )

If input file is like this :

We-passed-upon-the-stair We-spoke-of-was-and-when Although-I-wasn't-there He-said-I-was-his-friend Which-came-as-a-surprise

Output should look like this

We passed upon the stair We spoke of was and when Although I wasn't there He said I was his friend Which came as a surprise

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!