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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started