File tree Expand file tree Collapse file tree 1 file changed +17
-25
lines changed
Expand file tree Collapse file tree 1 file changed +17
-25
lines changed Original file line number Diff line number Diff line change 11from python import Python
22
3- def makeGood ():
4- let py = Python.import_module(" builtins" )
5- let enterword = py.input(" Enter a string: " )
6- s = enterword
7- str1 = str (enterword)
8- i = 0
9- result_list = []
3+ def makeGood (s : String):
4+ py = Python.import_module(" builtins" )
5+ result = str (" " )
106
11- while i < len (str1) - 1 :
12- if py.abs(ord (s[i]) - ord (s[i + 1 ])) == 32 :
13- i += 2
7+ i = 0
8+ while i < len (s):
9+
10+ if i < len (s) - 1 and py.abs(ord (s[i]) - ord (s[i + 1 ])) == 32 :
11+
12+ i += 2
1413 else :
15- py.result_list.append(s[i])
16- i += 1
14+
15+ result = result + s[i]
16+ i += 1
1717
18- if i == len (str1) - 1 :
19- py.result_list.append(s[- 1 ])
18+ print (result)
2019
21- # result = "".join(result_list)
22- py.print(result_list)
23-
24- # Example usage:
25-
26- # Taking input from the user
2720def main ():
28- makeGood()
29- # let py = Python.import_module("builtins")
30- # #let s = py.input("Enter a string: ")
31- # let input_string = str(input_string_py)
32- # let result = makeGood(input_string)
21+
22+ input_str = " leEeetcode"
23+ makeGood(input_str)
24+
3325 # print("After making the string good:", result)
You can’t perform that action at this time.
0 commit comments