← 返回 apple 的题目列表Check If Two Sentences Differ by Exactly One Edit
类型:online_judge
Given two sentences (sentence1, sentence2). Each sentence consists of words separated by a single space.
Define one edit on a sentence as one of:
insert one word,
delete one word,
replace one word.
Return true if and only if the two sentences differ by exactly one edit (i.e., you can transform sentence1 to sentence2 using exactly one edit). If the sentences are identical, return false.
Input
Two lines:
line 1: sentence1
line 2: sentence2
Output
Print true or false.
Constraints
1 ≤ number of words per sentence ≤ 1e5
Words contain no spaces
Single spaces only; no leading/trailing spaces
Examples
Input:
hello world
hello brave world
Output:
true
Input:
we are hiring
we are hiring
Output:
false
Example
Input
hello world
hello brave world
Output
true