結果

問題 No.1005 BOT対策
ユーザー MaboyMaboy
提出日時 2021-06-28 20:30:40
言語 Swift
(6.0.3)
結果
WA  
実行時間 -
コード長 408 bytes
コンパイル時間 10,494 ms
コンパイル使用メモリ 172,932 KB
実行使用メモリ 17,152 KB
最終ジャッジ日時 2024-06-25 15:08:38
合計ジャッジ時間 8,722 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 WA * 6
権限があれば一括ダウンロードができます

ソースコード

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)
0