-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from Ayush-kr-giga/main
Check if the report is Unvarnished or not
- Loading branch information
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!-- Purpose --> | ||
A company has a culture of reporting things as they are, whether good or bad. So we want to check whether the reported content is exactly the same as the original text. | ||
|
||
<!-- Question --> | ||
You are given two strings S and T, consisting of lowercase English letters. | ||
|
||
If S and T are equal, print 0; otherwise, print the position of the first character where they differ. Here, if the i-th character exists in only one of S and T', consider that the i-th characters are different. | ||
|
||
More precisely, if S and T' are not equal, print the smallest integer i satisfying one of the following conditions: | ||
|
||
β’ 1β€ i β€ len(S) ,1β€ i β€ len(T) , len(S) != len(T) | ||
β’ len(S)< i < len(T). | ||
β’ len(T) < i β€ len(S) | ||
|
||
<!-- Constraints --> | ||
|
||
S and T are strings of length between 1 and 100, inclusive, consisting of lowercase English letters. | ||
|
||
<!-- Sample Input 1 --> | ||
|
||
abcde | ||
abedc | ||
|
||
<!-- Sample Output 1 --> | ||
|
||
3 | ||
|
||
|
||
<!-- Sample Input 2 --> | ||
|
||
abcde | ||
abcdefg | ||
|
||
<!-- Sample Output 2 --> | ||
|
||
6 | ||
|
||
<!-- Sample Input 3 --> | ||
|
||
keyence | ||
keyence | ||
|
||
<!-- Sample Output 3 --> | ||
|
||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
S=input() | ||
T=input() | ||
|
||
if S==T: | ||
print(0) | ||
else: | ||
if len(S)==len(T): | ||
for i in range(len(S)): | ||
if S[i]!=T[i]: | ||
print(i+1) | ||
break | ||
elif len(S)>len(T): | ||
for i in range(len(T)): | ||
if S[i]!=T[i]: | ||
print(i+1) | ||
break | ||
else: | ||
a=len(S)-len(T) | ||
print(len(S)-a+1) | ||
else: | ||
for i in range(len(S)): | ||
if S[i]!=T[i]: | ||
print(i+1) | ||
break | ||
else: | ||
a=len(T)-len(S) | ||
print(len(T)-a+1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters