-
Notifications
You must be signed in to change notification settings - Fork 176
/
Copy pathsolution.py
47 lines (35 loc) · 924 Bytes
/
solution.py
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'possibleChanges' function below.
#
# The function is expected to return a STRING_ARRAY.
# The function accepts STRING_ARRAY usernames as parameter.
#
def possibleChanges(usernames):
ans = []
for u in usernames:
if len(u) <= 1:
ans.append("NO")
for i in range(len(u) - 1):
if u[i] > u[i + 1]:
ans.append("YES")
break
else:
ans.append("NO")
return ans
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_PATH'], 'w')
usernames_count = int(input().strip())
usernames = []
for _ in range(usernames_count):
usernames_item = input()
usernames.append(usernames_item)
result = possibleChanges(usernames)
fptr.write('\n'.join(result))
fptr.write('\n')
fptr.close()