Guest User

Untitled

a guest
Apr 25th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.78 KB | None | 0 0
  1. type word= packed array [1..10] of char;
  2.  
  3. var
  4. use:array[1..10] of boolean;
  5. i,j:integer;
  6. x,y:word;
  7. c:char;
  8. res,alreadyusedsomething:boolean;
  9.  
  10. begin
  11. for i:=1 to 10 do use[i]:=false;
  12.  
  13. x:=''; y:='';
  14. write('input first(10 symbols)>> ');
  15. for i:=1 to 10 do begin
  16.   read(c); x[i]:=c;
  17. end;
  18. readln;
  19. write('input second(10 symbols)>> ');
  20. for i:=1 to 10 do begin
  21.   read(c); y[i]:=c;
  22. end;
  23. readln;
  24.  
  25. for i:=1 to 10 do begin
  26.   alreadyusedsomething:=false;
  27.   for j:=1 to 10 do begin
  28.     if ((not use[j]) and (x[i]=y[j]) and (not alreadyusedsomething)) then begin
  29.       use[j]:=true; alreadyusedsomething:=true;
  30.     end;
  31.   end;
  32. end;
  33. res:=true;
  34. for i:=1 to 10 do if use[j]=false then res:=false;
  35.  
  36. if (res) then writeln('It is an anagram!') else writeln('It is not an anagram');
  37.  
  38. end.
Add Comment
Please, Sign In to add comment