首页 > BFS
头像 在努力的小哥哥很爱吃香菜
发表于 2025-08-05 18:48:11
s = input().strip() # 将原字符串转为全小写,目标子串也用全小写 lower_s = s.lower() target = "bob" try: # 查找目标子串第一次出现的位置 position = lower_s.index(targe 展开全文
头像 小琢卷不动
发表于 2021-11-24 09:29:26
按照题意模拟即可。 函数 B 用于判断一个字符是否是 B 的大小写。 函数 O 同理。 通过一个 for 循环找到我们要的答案,如果这一位是 b,下一个是 o,下下一个是 b 则输出当前位置。 都没有找到就输出 -1 即可。 #include<cstdio> #include<cs 展开全文
头像 ciallobite
发表于 2025-05-31 11:04:55
print(input().lower().find('bob')) 使用内置函数
头像 阿祖拉
发表于 2025-06-10 11:00:21
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = 展开全文
头像 5TACK
发表于 2025-06-06 10:25:46
#include <complex> #include <iostream> using namespace std; int main() { int idx1, idx2; string str; cin >> str; st 展开全文
头像 Xuan2333
发表于 2026-01-08 21:49:45
首先介绍string的函数---s.find(查找的字符串);用来查找函数是否存在要查找的字符串,如果有,返回其下标,没有的话会返回string::npos所以思路很简单了,直接查找所有的种类,有的话就输出下标并结束,没有的话就继续往下走代码就更简单啦! void _() { cin > 展开全文
头像 nuosu76
发表于 2025-08-26 22:13:39
#include <bits/stdc++.h> using namespace std; #define endl "\n" // #define debug using ll = long long; void solve() { string s; 展开全文
头像 克苏鲁娘
发表于 2026-01-21 15:27:11
#include <cctype> #include <iostream> #include <string> using namespace std; int Where(string num,int &n)//没有引用num,为了不改变原输入(虽然本题 展开全文
头像 LOGIC_vector
发表于 2026-01-20 16:53:33
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; for (int i=0;i<s.size();i++){ if((s[i]=='b'||s[i]=='B')& 展开全文
头像 牛客970534290号
发表于 2025-11-22 22:23:38
#include <stdio.h> #include<string.h> #include<ctype.h> int main() { char S[100] = { 0 }; char str[100] = "Bob"; 展开全文