#P115. 最後一個單詞

最後一個單詞

題目描述

計算字符串最後一個單詞的長度,單詞以空格隔開。

輸入格式

一行字符串,非空,長度小於5000。

輸出格式

整數N,最後一個單詞的長度。

Samples

["hello world","the best way to predict the future is to invent it"]
["5","2"]

原始資料

  • Zero1 題號:a115
  • Hydro 題號:Z0115
  • Locale:zh_TW
  • Display:open