結果
| 問題 |
No.1005 BOT対策
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-06-28 20:25:01 |
| 言語 | Swift (6.0.3) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 399 bytes |
| コンパイル時間 | 10,341 ms |
| コンパイル使用メモリ | 171,236 KB |
| 実行使用メモリ | 19,528 KB |
| 最終ジャッジ日時 | 2024-06-25 15:02:33 |
| 合計ジャッジ時間 | 12,751 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 RE * 3 |
ソースコード
import Foundation
var s = String(readLine()!)
let t = String(readLine()!)
var c = 0
if t.count == 1 && s.contains(t){
print(-1)
}else{
var q = s
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)
}