a038. 數字翻轉 5/16/2025

解法一

✅ 完整代碼

評分結果(參考) : AC (2ms, 308KB)

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string s;
    cin >> s;

    bool ignore0 = true;
    for(int i=s.size()-1; i>=0; i--){
        if(s[i]!='0' || i == 0) ignore0 = false;
        if(!ignore0) cout << s[i];
    }

    return 0;
}