Problem 242. Make a function that returns its own character count

Solution 60043

Submitted on 12 Mar 2012 by David Young
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
fname = 'omphaloskeptic.m'; fid = fopen(fname); file = textscan(fid,'%c', ... 'CommentStyle','%', ... 'Whitespace',''); fclose(fid); ha = histc(file{1},1:128); hp = omphaloskeptic; assert(~any(ismember(33:41,find(ha))),'Used an illegal character'); assert(isequal(ha,hp),'Actual characters did not match prediction');

{Warning: File: omphaloskeptic.m Line: 2 Column: 1 'bcghjklmnopqrstuvwyzbcdefghjklmpqstuvwxyzbcdefghijklmnopqrstuvwxyzbcdefghijklmnopqrstuvwxyzbcdefghijklmnopqrstuvwxyzbcdefghijklmnopqrstuvwxyzbcdefghijklmnopqrstuvwxyzbcdefghijklmnopqrstuvwxyzbcdefghijklmnopqrstuvwxyzbcdefghijklmnopqrstuvwxyzbcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwyzabcdefghjklmnpqrsvwyzbcdfghjklmpqrstuvwyzbeghjklmqrstuvwyzbdgjquvwyz' exceeds the MATLAB maximum name length of 63 characters and will be truncated to 'bcghjklmnopqrstuvwyzbcdefghjklmpqstuvwxyzbcdefghijklmnopqrstuvw'.} {> In verifyCode>evaluateCode at 189 In verifyCode at 37 In fevalJSON at 14}

Suggested Problems

More from this Author50

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!