%%
clear
IDIOMA = 'Portugues';
% IDIOMA = 'Ingles';
% IDIOMA = 'Holandes';
A = leia_lista( IDIOMA );

%%
for j = 1:26
    onde_tem = strfind( A(1:end-1), char(96+j) );
    depois_tem = A(onde_tem+1);
    [ yH ] = hist( double(depois_tem), 1:255 );
%     fH(j,:) = yH/sum(yH);
    fH{j} = yH/sum(yH);
end

%%
for j1= 26:-1:1
    for j2= 26:-1:1
        D(j1,j2) = sum( abs(fH{j1}-fH{j2}) );
    end
end
%%
figure, imagesc( D )
set( gca, 'xtick', 1:26, 'xticklabel', char(97:122)' )
set( gca, 'ytick', 1:26, 'yticklabel', char(97:122)' )
colormap( gray )
title( IDIOMA )