官方题解
2025-12-01 00:10:50
发布于:浙江
26阅读
0回复
0点赞
题目大意
输出字符串中唯一一个大写字母所在位置。
解题思路
遍历字符串,找到大写字母,输出对应位置即可。
参考代码
#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int main(){
string s;cin>>s;
s=' '+s;
for(int i=1;i<s.size();i++){
if(s[i]>='A' && s[i]<='Z'){
cout<<i<<endl;
}
}
return 0;
}
这里空空如也






有帮助,赞一个