https://leetcode.com/problems/make-the-string-great/
1
2
3
4
5
6
7
8
9
10
class Solution(object):
def makeGood(self, s):
"""
:type s: str
:rtype: str
"""
for i in range(len(s)-1):
if (s[i] != s[i+1]) & (s[i].lower() == s[i+1].lower()):
return self.makeGood(s[:i] + s[i+2:])
return s
https://github.com/restato/Algorithms/blob/master/leetcode/make-the-string-great.py