#29563: C++紀錄


e3524167 (Kenlogin)

學校 : 不指定學校
編號 : 186743
來源 : [182.233.207.92]
最後登入時間 :
2022-03-17 21:12:56
a038. 數字翻轉 | From: [182.233.207.92] | 發表日期 : 2022-03-12 04:07

#include <iostream>

#include <string> 

#include <sstream>

using namespace std;

 

int main()

{

string x;

while (cin >> x)

{

string y;

for (int i = x.length()-1; i >= 0; i--)

{

y = y + x[i];

}

while (y[0] == '0' && y.length()>1)

{

y.erase(0, 1);

}

cout << y << endl;

}

}

 
ZeroJudge Forum