Cody

# Problem 464. Function Sniffer

Solution 66737

Submitted on 28 Mar 2012 by Aurelien Queffurust
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
%% x = 'x=cos(theta); y=sin(beta);' y_correct = 'cos sin'; assert(isequal(sniffing(x),y_correct))

x = x=cos(theta); y=sin(beta); S0 = 'beta' 'theta' 'x' 'y' S_temp = 2 0 0 0 S0 = 'beta' 'theta' 'x' 'y' S2 = 'beta' 'cos' 'sin' 'theta' 'x' 'y' S3 = 'cos' 'sin' S4 = cos sin S4 = cos sin

2   Pass
%% x = 'x=sum(1:100); y=sqrt(x);' y_correct = 'sqrt sum'; assert(isequal(sniffing(x),y_correct))

x = x=sum(1:100); y=sqrt(x); S0 = 'x' 'y' S_temp = 0 0 S0 = 'x' 'y' S2 = 'sqrt' 'sum' 'x' 'y' S3 = 'sqrt' 'sum' S4 = sqrt sum S4 = sqrt sum

3   Pass
%% x = 'x=ones(round(7.7))-rand;' y_correct = 'ones rand round'; assert(isequal(sniffing(x),y_correct))

x = x=ones(round(7.7))-rand; S0 = 'rand' 'x' S_temp = 5 0 S0 = 'x' S2 = 'ones' 'rand' 'round' 'x' S3 = 'ones' 'rand' 'round' S4 = ones rand round S4 = ones rand round