Answered You can hire a professional tutor to get the answer.
reads in a string from the user and prints out the most common character and how many times it occurs in the string. Hi tutor Here is my code and i...
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.