Cody

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

Solution 128905

Submitted on 18 Aug 2012 by Khaled Hamed
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 10 1 1 2 2 3 3 4 6 8 6 Columns 11 through 19 6 7 7 8 8 9 9 3 3 ans = Columns 1 through 10 0 0 0 0 0 0 0 0 127 0 Columns 11 through 20 0 0 0 0 0 0 0 0 0 0 Columns 21 through 30 0 0 0 0 0 0 0 0 0 0 Columns 31 through 40 0 25 0 0 0 0 0 0 0 0 Columns 41 through 50 0 0 0 0 0 0 0 97 10 12 Columns 51 through 60 9 10 2 5 4 3 4 0 3 0 Columns 61 through 70 4 0 0 0 0 0 0 0 0 0 Columns 71 through 80 0 0 0 0 0 0 0 0 0 0 Columns 81 through 90 0 0 0 0 0 0 0 0 0 0 Columns 91 through 100 4 0 4 0 0 0 6 0 2 1 Columns 101 through 110 2 2 0 1 4 0 1 1 3 6 Columns 111 through 120 4 2 0 3 4 4 3 0 0 0 Columns 121 through 128 0 0 0 0 0 0 0 0

### Community Treasure Hunt

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

Start Hunting!