Question: please make sure it is using C program and have file input and iutput. Thank you. Let S be a well-formed string of parenthesis. S
Let S be a well-formed string of parenthesis. S can be encoded into P-sequence and W-sequence. P-sequence is the sequence of the numbers of left parentheses before its right parenthesis. W-sequence is the sequence of the numbers of right parentheses counting from the matched left parenthesis. S (((000))) P-sequence 4 5 6666 W-sequence 1 1 1456 Your program should read the input from the file, and output the answer to another file. The first argument is the input file name, while the second argument is the output file name. Name your program as "lab4-94.c". Input file: The first line is an integer n (1 sn s 20), and the second line is the P-sequence of a well-formed string. It contains n positive integers separated by a space. Output file: A line contains n integers, separated by a space, describing the W-sequence of the string corresponding to its given P-sequence Sample Input: 6 4 5 6 6 6 6 Sample Output: 1 1 1 4 5 6
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
