Because i want to know different ways to solve it, Can u write it in another way like using function?

string=”hello world”;

letter=0;

count=0;

A=[]; % print out frequent number in a array.

for i=1:string

 letter=string(i);

 for j=1:string(i)

   if letter==string(j)

     A=[A letter];

     count=count+1;

   end

 end

end

fprintf(“the most common character in the word is %d”, letter);

fprintf(“letter %d appeared %d times”, letter, count); 

disp(A);

better have some comments.

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now