blob: 0e88ad89c82cb635d027980ad1984ecf41ef88a9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#!/usr/bin/env python
class Solution:
def largestGoodInteger(self, num: str) -> str:
if '999' in num:
return '999'
if '888' in num:
return '888'
if '777' in num:
return '777'
if '666' in num:
return '666'
if '555' in num:
return '555'
if '444' in num:
return '444'
if '333' in num:
return '333'
if '222' in num:
return '222'
if '111' in num:
return '111'
if '000' in num:
return '000'
return ""
def main():
solution = Solution()
print(solution.largestGoodInteger("6777133339"))
if __name__ == "__main__":
main()
|