結果
| 問題 |
No.342 一番ワロタww
|
| コンテスト | |
| ユーザー |
jj
|
| 提出日時 | 2017-02-03 21:17:09 |
| 言語 | Fortran (gFortran 14.2.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,401 bytes |
| コンパイル時間 | 1,328 ms |
| コンパイル使用メモリ | 32,992 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-15 13:35:00 |
| 合計ジャッジ時間 | 802 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
program main
implicit none
character*600::S
character*600::www
character*3::w="w"
integer::wstart(100),wend(100)
integer::i,j,len,utf8len,Wl,wlmax,start
data wl/0/,wlmax/0/
read *, S
len = LEN_TRIM(S)
start = VERIFY(TRIM(S),w)
if(start.eq.0) then
print '(a)'
return
end if
!get max w len
i = start
do
if(i.gt.len) exit
utf8len = get_utf8_len(S(i:i))
if(utf8len.eq.3.and.S(i:i+2).eq.w) then
wl = wl + 1
if(wl.gt.wlmax) then
wlmax = max(wl, wlmax)
end if
else
wl = 0
end if
i = i + utf8len
end do
if((wlmax.eq.0).or.(wlmax*3.eq.len)) then
print '(a)'
return
end if
www = REPEAT(w,wlmax)
i = start
j = start
do
if(i.gt.len-wlmax*3+1) exit
utf8len = get_utf8_len(S(i:i))
if(S(i:i+2).eq.w) then
if(TRIM(www).eq.S(i:i+wlmax*3-1)) then
if(i.ne.1) print '(a)',S(j:i-1)
end if
j = i + utf8len
else
end if
i = i + utf8len
end do
return
contains
logical function is_ascii(c) result(l)
character::c
l = .not.BTEST(ICHAR(c,1),7)
end function is_ascii
integer function get_utf8_len(c) result(len)
character::c
integer*1::ic
ic = ICHAR(c,1)
if(.not.BTEST(ic,7)) then
len = 1
else
len = LEADZ(NOT(ic))
end if
end function get_utf8_len
end program main
jj