题解 | #判断数字位置#

判断数字位置

https://www.nowcoder.com/practice/55d5708cd4ab472b9c2969f9846f32ec

#include <bits/stdc++.h>
using namespace std;
int main() {
    int m;
    cin>>m;
    while (m--) { 
        string str;
        cin>>str;
        vector<int> a;
        for(int i=0;i<str.size();i++)
        {
            if(str[i]>='0'&&str[i]<='9') a.push_back(i+1);
        }
        for(int i=0;i<a.size();i++) cout<<a[i]<<" ";
        cout<<endl;   
    }
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务