Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

language is C++. please use comments 2. Program and input specification You will get a list of strings in an input file. Each line will

language is C++. please use commentsimage text in transcribedimage text in transcribedimage text in transcribed

2. Program and input specification You will get a list of strings in an input file. Each line will be considered as a single string. You need to find out the length of the common subsequence of characters from those strings which is the longest one. Assumptions: The input file is a small plain text file; no need to handle binary files. Each input file can have maximum 4 strings. A string can have maximum 1000 characters. An input file may contain empty lines between strings, then you will ignore it. The output should be exactly matched with the format. . . . . The main C++ program will become the executable to be tested by the TAs. The Result file should be written to another text file (output file), provided with the Command line. Notice the input and output files are specified in the command line, not inside the C++ code. Notice also the quotes in the program call, to avoid Unix/Windows gets confused. 3. Input and Output The input and output files are regular text files, where each line is terminated with a 'In' character. Each line will be treated as a string. The output file will contain the output. The output will be "Len:"+ the length of the subsequence. Note, in "Len: ", there is a space after the colon(:). 4. Program Execution: The general call to the executable is as follows Subsequence "input-input1.txtoutput-output1.txt" You can call the example with another command line type, Subsequence input-input1.txt output output1.txt 5. Examples Example 1 of input and output, Input11.txt abcd321ABCD abcD123ABCd Command line Subsequence input-input11.txt output-output11.txt Output11.txt Len: 7 Example 2 of input and output, Input12.txt Data Structures Using C++ Data Structures Using Java COSC 2430 is Data Structures course Data Structures Command line Subsequence input-input12.txt output-output12.txt Output12.txt Len: 15 Example 3 of input and output, Input13.txt Data Structures is an interesting course // empty line will not be counted We love Data Structures course Command line Subsequence input-input13.txt output-output13.txt Output13.txt Len: 23 include include tinclude #include isstream using namespace std; // This is class that can parse the conmnad line areuments class ArgumentManagrf private us in COSC 243A homework nap string, stringmargunentMap; public: Argumen LMaagerE) ArgumentManager(int argc, char *arg, char deliniter-' ArgumentManager(string reArguments, char delimiter';'); void parse(int arec, char arav char delimiter-"; void parselstrine rawAreunents, char deliniter-';; string get(string argumentName); tring tostring); triend ostream& operator (ostream &out, ArgumentManager &am); void ArgumentManager: :parse(string arguments, cher delimiter) ( stringstrean currentArgunentName stringstream currentAraunentvalue; bool areunentNameFinished false; (unsigned it (1 -rawargunents.length(); Il i++) !Argument s Lj for int rawArguments.length() 1-0; { ;; delimit cr) r { (currentArgumentName . str() m_arguneritMap[currentArgument Nane.stcurrentArgumeritValue.str; !-" /i reset currentArgumentNane. str(" currentArgumentvalue.str argumentamoFinished - false; alse it (rmentsl] argumentNaneFinished true; else ( if (argunentNameFinished) ( currentArgumentValue 1) 1 char argv[], char del ini ter) { for (int i-1; isecond; strine ArgunentHanager::toStrine stringstream ss for (mapkstring, string::iterator iter-n_argumentHap.begin); iter n_argumentMap.end); itr i ss "Argument name : " first endl; ss "Argument value : " second

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What are the steps in the strategic planning process?

Answered: 1 week ago