function [str, nCaps] = caps(str)
% Post: Capitalize 1st letter of each word.
% str= partially capitalized string
% nCaps= no. of capital letters
% Pre: str= string with lower case letters and blanks only

nCaps= 0;
for k= 2:length(str)
if (str(k-1)==' ' && isletter(str(k)))
str(k)= upper(str(k));
nCaps= nCaps + 1;
end
end

if (isletter(str(1)))
str(1)= upper(str(1));
nCaps= n + 1;
end