2 条题解

  • 1
    @ 2024-7-11 15:18:08

    #include <iostream> #include <string>

    int main() { std::string str; std::cin >> str;

    std::string digitStr, charStr;
    
    for (size_t i = 0; i < str.size(); ++i) {
        char c = str[i];
        if (isdigit(c)) {
            digitStr += c;
        } else if (isupper(c)) {
            charStr += c;
        }
    }
    
    std::cout << digitStr << charStr << std::endl;
    
    return 0;
    

    }

    • -1
      @ 2023-8-3 17:53:00

      #include <bits/stdc++.h> using namespace std; int main(){


      **string** **s**,**z**=**""**,**d**=**""**;
      

      ** cin>>s;** ** int p=s.size();** ** for(int i=1;i<=p;i++){** ** if(s[i]>='0'&&s[i]<='z')** ** z+=s[i];** ** else if(s[i]>='A'&&s[i]<='Z'){** ** d+=s[i];** ** } ** } ** cout<<z<<d; ** return 0; }

      • 1

      信息

      ID
      988
      时间
      1000ms
      内存
      256MiB
      难度
      4
      标签
      递交数
      111
      已通过
      34
      上传者