Guest User

Untitled

a guest
Aug 18th, 2018
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.60 KB | None | 0 0
  1. var i, j, count1, count2, sumFF: integer;
  2. s1, s2: string;
  3. k: char;
  4. begin
  5. readln(s1);
  6. readln(s2);
  7. sumFF := 0;
  8. for i:=1 to length(s1) do begin
  9. k := UpCase(s1[i]);
  10. if ('A' <= k) and (k <= 'Z') then begin
  11. count1 := 1;
  12. for j:=i+1 to Length(s1) do
  13. if k = UpCase(s1[j]) then begin
  14. count1 := count1 + 1;
  15. s1[j] := ' ';
  16. end;
  17. count2 := 0;
  18. for j:=1 to Length(s2) do
  19. if k = UpCase(s2[j]) then
  20. count2 := count2 + 1;
  21. writeln(k, ' ', count1, ' ', count2);
  22. sumFF := sumFF + count1 * count2;
  23. end;
  24. end;
  25. if length(s1) * length(s2) > 0 then
  26. writeln(sumFF/(length(s1) * length(s2)):10:3)
  27. else
  28. writeln(0);
  29. end.
Add Comment
Please, Sign In to add comment