#K94282. One Edit Away

    ID: 38607 Type: Default 1000ms 256MiB

One Edit Away

One Edit Away

You are given two strings ( s ) and ( t ). Your task is to determine whether these two strings are one edit away from each other. An edit is defined as either inserting a character, deleting a character, or replacing a character. For example, the strings "pale" and "ple" are one edit away (deletion/insertion), while "pale" and "bake" are not.

More formally, given two strings ( s ) and ( t ), determine if it is possible to make ( s = t ) by performing at most one of the following operations:

[ \text{insert}(c) \quad \text{or} \quad \text{delete}(c) \quad \text{or} \quad \text{replace}(c) ]

where ( c ) denotes a single character. This problem tests your understanding of string manipulation and attention to edge cases.

inputFormat

The input consists of two lines read from standard input (stdin):

  • The first line contains the string ( s ).
  • The second line contains the string ( t ).

Both strings are composed of ASCII characters and may be empty.

outputFormat

Print to standard output (stdout) a single line containing either "True" if the two strings are one edit away from each other, or "False" otherwise.## sample

pale
ple
True