-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtarun.py
32 lines (32 loc) · 893 Bytes
/
tarun.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
n = int(input())
s = input()
def james(n,s):
f = ['O']*len(s)
for i in range(len(s)):
if i == 0 and s[i] == 'c':
f[i] = 'I'
if i+1 <= len(s):
f[i+1] = 'I'
if i+2 <= len(s):
f[i+2] = 'I'
elif i == 1 and s[i] == 'c':
f[i] = 'I'
f[i-1] = 'I'
if i+1 <= len(s):
f[i+1] = 'I'
if i+2 <= len(s):
f[i+2] = 'I'
else:
if s[i] == 'c':
f[i] = 'I'
f[i-1] = 'I'
f[i-2] = 'I'
if i+1<len(s):
f[i+1] = 'I'
if i+2<len(s):
f[i+2] = 'I'
if s[i] == 'n' and s[i-1] != 'c' and s[i-2]!='c':
f[i] = 'U'
return "".join(f)
#print(james(n,s))
james(n,s)