#12509: Python的部分若用while來寫,可以通過測試,但解答上傳過不去~~~


apacph (Apacph)


如題,

故意用while寫,不用Python的特異功能來寫,
自己測試都是OK的,
也在此網站上通過測試,
但是使用解答上傳時卻出現系統在字串前面增加一堆000000的字串,
請問自動檢測有問題嗎?
有人可以回應一下嗎?

我的簡單while程式碼已經故意越改越長,讓所有可能出錯的地方都顯現出來嚕,如下,請指正。

import sys

def Calc(sStr):
  iCnt = len(sStr)
  sOutput = ''
  while (iCnt > 0):
    sDigit = sStr[iCnt - 1: iCnt]
    sOutput += sDigit
    iCnt -= 1
  print(sOutput)

# main
sInput = sys.stdin.readline()
sInput = sInput[:len(sInput)-1]
Calc(sInput)