結果

問題 No.3035 文字列のみの反転
ユーザー drazerd
提出日時 2025-03-18 05:30:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 2,182 ms
コンパイル使用メモリ 194,400 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-18 05:30:09
合計ジャッジ時間 3,093 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <bits/stdc++.h>
using namespace std;

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

    std::string digits;
    std::string nonDigits;

    for (int i = s.length() - 1; i >= 0; --i) {
        if (std::isdigit(s[i])) {
            digits += s[i];
        } else {
            nonDigits += s[i];
        }
    }
    reverse(digits.begin(),digits.end());
    std::cout << nonDigits;
    std::cout << digits;

    return 0;
}
0