- プログラミングのお題スレ Part3
484 :デフォルトの名無しさん[sage]:2014/04/13(日) 19:23:26.62 ID:FjBeXDNH - >>482 HSP
#module #defcfunc f482 str s_, local s, local count, local c, local max_index, local is_valid s=s_ dim count, 256 repeat strlen(s) c=peek(s, cnt) count(c)++ if max_index!c { if count(max_index)=count(c) : is_valid=0 if count(max_index)<count(c) : max_index=c : is_valid=1 } loop return strf("%c", max_index*is_valid) #global mes f482("aabaabbab")
| - プログラミングのお題スレ Part3
487 :デフォルトの名無しさん[sage]:2014/04/13(日) 19:57:03.42 ID:FjBeXDNH - こういうこと?
#module #defcfunc f482 str s_, local s, local char1, local char2 s=s_ char1=strmid(s, 0, 1) strrep s, char1, "" count1=stat char2=strmid(s, 0, 1) count2=strlen(s) if count1>count2 : return char1 if count1<count2 : return char2 return "" #global mes f482("aabaabbab")
| - プログラミングのお題スレ Part3
492 :デフォルトの名無しさん[sage]:2014/04/13(日) 20:22:37.50 ID:FjBeXDNH - >>484 バグってた
if count(max_index)=count(c) : is_valid=0 ↓ if count(max_index)=count(c) : max_index=c : is_valid=0
|
|