Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Find correct assignment statements. Part 3 Cost: 1 6 | Solved: 1 Memory limit: 2 5 6 Mb Time limit: 1 0 0 0 ms
Find correct assignment statements. Part
Cost: Solved:
Memory limit: Mb
Time limit: ms
Input file: stdin
Output file: stdout
Task:
You are given a set of strings separated with line feed characters.
Find all the substrings that are correct assignment statements.
The general formula for a valid assignment statement is x y; where x is the first operand, y is the second operand. Note that there may be several whitespace characters between the operands.
In this task a string is considered to be a correct assignment statement when:
a variable is assigned to a constant value;
a variable is assigned to another variable;
a variable is assigned to an arithmetic expression;
a variable is assigned to an array element which index is either a numeric value, a variable or an arithmetic expression.
For example, the strings aa;a b;aibj;az;af;aza;a zi;a zi; are considered to be correct assignment statements note that there is a semicolon at the end of each statement
The strings aa;an;d#$&har; are considered to be incorrect.
Input:
A set of strings separated with line feed characters.
Output:
All the longest correct substrings in the order in which they appear in the text, separating each with a line feed character.
Use only C
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