結果

問題 No.1005 BOT対策
ユーザー MaboyMaboy
提出日時 2021-06-28 20:32:40
言語 Swift
(5.10.0)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 3,154 ms
コンパイル使用メモリ 153,080 KB
実行使用メモリ 14,728 KB
最終ジャッジ日時 2023-09-07 21:33:08
合計ジャッジ時間 4,825 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
14,288 KB
testcase_01 AC 6 ms
14,248 KB
testcase_02 AC 6 ms
14,728 KB
testcase_03 AC 7 ms
13,828 KB
testcase_04 AC 6 ms
13,644 KB
testcase_05 AC 7 ms
14,560 KB
testcase_06 AC 7 ms
14,392 KB
testcase_07 AC 6 ms
13,924 KB
testcase_08 AC 7 ms
14,200 KB
testcase_09 AC 7 ms
14,008 KB
testcase_10 AC 6 ms
13,644 KB
testcase_11 AC 7 ms
14,356 KB
testcase_12 AC 16 ms
14,412 KB
testcase_13 AC 8 ms
13,732 KB
testcase_14 AC 11 ms
14,032 KB
testcase_15 AC 8 ms
13,840 KB
testcase_16 AC 8 ms
14,008 KB
testcase_17 AC 7 ms
14,236 KB
testcase_18 AC 6 ms
13,764 KB
testcase_19 AC 6 ms
13,640 KB
testcase_20 AC 7 ms
14,088 KB
testcase_21 AC 6 ms
13,152 KB
testcase_22 AC 7 ms
13,724 KB
testcase_23 AC 6 ms
13,268 KB
testcase_24 AC 11 ms
14,164 KB
testcase_25 AC 14 ms
14,392 KB
testcase_26 AC 15 ms
14,612 KB
testcase_27 AC 6 ms
13,916 KB
testcase_28 AC 98 ms
14,564 KB
testcase_29 AC 7 ms
14,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import Foundation
var s = String(readLine()!)
let t = String(readLine()!)
var q = s
var c = 0
if t.count == 1 && s.contains(t){
    print(-1)
}else if s.contains(t){
    let i = t.index(before: t.endIndex)
    let p = t[...t.index(before: i)] + "." + t[i...]
    while q.contains(t){
        let r = q.range(of: t)!
        q = q.replacingOccurrences(of: t, with: p,range: r)
    }
    print(q.count - s.count)
}else{
    print(q.count - s.count)
}
0