Skip to content

Commit 6666d71

Browse files
authored
Update problem-5.mojo
1 parent 64ddea4 commit 6666d71

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

problem-5/problem-5.mojo

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
from python import Python
22

3-
def findTheDifference():
3+
def findTheDifference(s:String, t:String):
44
py = Python.import_module("builtins")
5-
65

7-
s = py.input("Enter the first string (s): ")
8-
t = py.input("Enter the second string (t): ")
9-
10-
for i in t:
11-
if s.find(i) == -1:
12-
13-
print("The difference is:",i)
14-
return
15-
elif s.count(i) != t.count(i):
16-
17-
print("The difference is:", i)
18-
return
6+
for i in range(len(t)):
7+
if s[i] != t[i]:
8+
result = t[i]
9+
print("The difference is:")
10+
print(result)
11+
break
1912

2013
def main():
21-
22-
findTheDifference()
14+
findTheDifference("abcd", "abced")

0 commit comments

Comments
 (0)