Skip to content

Commit

Permalink
Merge pull request #96 from Ayush-kr-giga/main
Browse files Browse the repository at this point in the history
Check if the report is Unvarnished or not
  • Loading branch information
Kushal997-das authored Oct 26, 2024
2 parents f452c4a + e7f8ec5 commit 7943934
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 0 deletions.
45 changes: 45 additions & 0 deletions Beginner Level πŸ“/Unvarnished report/question.md
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
27 changes: 27 additions & 0 deletions Beginner Level πŸ“/Unvarnished report/solution.py
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)
5 changes: 5 additions & 0 deletions Beginner Level πŸ“/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,9 @@
"name": "Dhara Bindal",
"githubUsername": "bindaldhara"
}

{
"name":"Ayush kumar",
"githubUsername":"Ayush-kr-giga"
}
]

0 comments on commit 7943934

Please sign in to comment.