제출 #920581

#제출 시각아이디문제언어결과실행 시간메모리
920581zeroday1934구슬과 끈 (APIO14_beads)Cpython 3
0 / 100
11 ms2908 KiB
def break_and_join(inp, idx): pp = inp[:idx] sp = inp[idx:] r = sp + pp return r def count(string): c=0 for j in range(len(string)): if(string[j]=='w'): c+=1 else: ch=string[j] for i in range(j,len(string)): if(string[i]==ch or string[i]=='w'): c+=1 else: break break for k in range(len(string)-1,-1,-1): if(string[k]=='w'): c+=1 else: ch=string[k] for i in range(k,i>=0,-1): if(string[i]==ch or string[i]=='w'): c+=1 else: break break if(c>len(string)): c=len(string) return c N=int(input()) necklace=input() f.close() counter=0 for i in range(N): res=break_and_join(necklace,i) c_count=count(res) if(c_count>counter): counter=c_count print(c_count)
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...