Cody

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

Solution 178041

Submitted on 16 Dec 2012 by Richard Zapor
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');

ans = Columns 1 through 16 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 Columns 17 through 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 Columns 33 through 48 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 97 Columns 49 through 64 10 12 9 10 3 5 4 3 4 0 3 0 4 0 0 0 Columns 65 through 80 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 81 through 96 0 0 0 0 0 0 0 0 0 0 3 0 3 0 0 0 Columns 97 through 112 6 0 2 1 2 2 0 1 4 0 1 1 2 5 4 2 Columns 113 through 128 0 2 3 3 2 0 0 0 0 0 0 0 0 0 0 0 a = []