Path Crossing


Submit solution

Points: 10
Time limit: 1.0s
Memory limit: 256M

Authors:
Problem type

題目說明

輸入一個僅由字元NESW組成的字串

從(0,0)出發,一次移動一格,例如N的話就是移動到 (0,1),以此類推

請判斷路徑有沒有再次走到已經經過的座標,有的話輸出true,無則輸出false,此題不部份給分

輸入

由字元NESW組成的字串

輸出

是否有走到經過過的座標

sample input1

NES

sample output1

false

sample input2

NESWW

sample output2

true

Comments

There are no comments at the moment.