Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program ideone;
- var
- cnt: array[1..26, 1..26] of integer;
- i, j, itf, its: integer;
- c: char;
- s: string;
- begin
- for i := 1 to 26 do
- for j := 1 to 26 do
- cnt[i][j] := 0;
- read(s);
- for i := 1 to length(s) do
- begin
- if (s[i] = ',') or (s[i] = '.') then
- begin
- j := i - 1;
- while (j >= 1) and (s[j] <> ',') do
- j := j - 1;
- cnt[ord(s[j + 1]) - ord('a') + 1][ord(s[i - 1]) - ord('a') + 1] :=
- cnt[ord(s[j + 1]) - ord('a') + 1][ord(s[i - 1]) - ord('a') + 1] + 1;
- end;
- end;
- itf := 1;
- its := 1;
- for i := 1 to 26 do
- for j := 1 to 26 do
- if cnt[i][j] > cnt[itf][its] then
- begin
- itf := i;
- its := j;
- end;
- writeln(chr(itf + ord('a') - 1), ' ', chr(its + ord('a') - 1));
- end.
Advertisement
Add Comment
Please, Sign In to add comment