Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##
- function is_one_away(word1, word2: string): boolean;
- begin
- var cnt := 0;
- if (Length(word1) = Length(word2)) then
- for var i := 1 to Length(word1) do
- if (word1[i] = word2[i]) then cnt +=1;
- if (cnt = 3) then result := true else result := false;
- end;
- //
- var (word1, word2) := ReadString2;
- Print(is_one_away(word1, word2));
Advertisement
Add Comment
Please, Sign In to add comment