---
title: "1544. Make The String Great"
url: "https://laigary.com/interview/coding/1544-make-the-string-great"
type: "note"
section: "coding"
date: "2025-04-02"
updated: "2025-04-02"
tags: ["Stack"]
---

# 1544. Make The String Great

[1544\. Make The String Great](https://leetcode.com/problems/make-the-string-great/)

```python
class Solution:
    def makeGood(self, s: str) -> str:
        
        if len(s) == 0:
            return s
        
        res = []
        
        for c in s:
            if res:
                if res[-1].upper() == c.upper():
                    if (res[-1].isupper() and c.islower()) or (res[-1].islower() and c.isupper()):   
                        res.pop()
                        continue
            res.append(c)
        return ''.join(res)
            
```
