题目描述

Snuke lives on an infinite two-dimensional plane. He is going on an N-day trip. At the beginning of Day 1, he is at home. His plan is described in a string S of length N. On Day i(1≤i≤N), he will travel a positive distance in the following direction:

North if the i-th letter of S is N
West if the i-th letter of S is W
South if the i-th letter of S is S
East if the i-th letter of S is E
He has not decided each day's travel distance. Determine whether it is possible to set each day's travel distance so that he will be back at home at the end of Day N.

Constraints
1≤|S|≤1000
S consists of the letters N, W, S, E.

输入

The input is given from Standard Input in the following format:
S

输出

Print Yes if it is possible to set each day's travel distance so that he will be back at home at the end of Day N. Otherwise, print No.

样例输入

SENW

样例输出

Yes

提示

If Snuke travels a distance of 1 on each day, he will be back at home at the end of day 4.

这题队友WA了3发。。。

主要是那句 He has not decided each day's travel distance.

这个其实东南西北只要都走一遍就好了

Wanna go back home的更多相关文章

  1. 题目1162:I Wanna Go Home(最短路径问题进阶dijkstra算法))

    题目链接:http://ac.jobdu.com/problem.php?pid=1162 详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus 参考代码: ...

  2. BNUOJ 52308 We don't wanna work! set模拟

    题目链接: https://acm.bnu.edu.cn/v3/problem_show.php?pid=52308 We don't wanna work! Time Limit: 60000msM ...

  3. HDU 5308 I Wanna Become A 24-Point Master(2015多校第二场)

    I Wanna Become A 24-Point Master Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 ...

  4. 2015多校联合训练赛 hdu 5308 I Wanna Become A 24-Point Master 2015 Multi-University Training Contest 2 构造题

    I Wanna Become A 24-Point Master Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 ...

  5. HDU 5308 I Wanna Become A 24-Point Master

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5308 题面: I Wanna Become A 24-Point Master Time Limit ...

  6. A - I Wanna Be the Guy

    Problem description There is a game called "I Wanna Be the Guy", consisting of n levels. L ...

  7. 2015 Multi-University Training Contest 2 hdu 5308 I Wanna Become A 24-Point Master

    I Wanna Become A 24-Point Master Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 ...

  8. When you want to succeed as bad as you wanna breathe, then you’ll be successful.

    上周末登了次山,回来就各种矫情犯懒.今天周四一周又要完蛋,我发现自己真的是对时间流逝无可奈何.然后中午看了把小码哥网站还有MJ博客什么的,各种首期班大爆照,心中羞愧无比.年纪大也不能放弃自己啊,要不人 ...

  9. We don't wanna work!

    We don't wanna work! [JAG Asia 2016] 两个set,一个代表工作的,一个代表不工作的 其实是一个很简单的模拟,但是我竟然排序之前标号.... 检查代码的时候要从头开始 ...

  10. 2016弱校联盟十一专场10.3---We don't wanna work!(STL--set的使用)

    题目链接 https://acm.bnu.edu.cn/v3/contest_show.php?cid=8504#problem/C 代码如下: #include <iostream> # ...

随机推荐

  1. unzip 小坑

    unzip test.zip 直接将zip解压到当前目录下,保留test级目录. unzip test.war 直接将.war解压到当前目录,不保留test级目录,所以建议使用 unzip test. ...

  2. Class.forName(String className)解析

    功能: Class.forName(xxx.xx.xx)返回的是一个类 Class.forName(xxx.xx.xx)的作用是要求JVM查找并加载指定的类, 也就是说JVM会执行该类的静态代码段 一 ...

  3. 游戏引擎UE4详解!

    UE4 的全名是 Unreal Engine 4,中文译为“虚幻引擎4”.UE4 是一款由 Epic Games 公司开发的开源.商业收费.学习免费的游戏引擎.那你了解UE4吗?如果还不清楚,就一起来 ...

  4. ZOJ 3757 Alice and Bod 模拟

    上次的ZJU月赛题,规则比较复杂,当时就连题意都没摸清楚,只觉得非常复杂 比完后敲啊敲啊敲,连续WA啊,该反思下自己,没按照题意来设置条件,题目中说了 白球入袋并且... 给对手加分 ,白球未入袋并且 ...

  5. 视觉slam十四讲个人理解(ch7视觉里程计1)

    参考博文::https://blog.csdn.net/david_han008/article/details/53560736 https://blog.csdn.net/n66040927/ar ...

  6. JS用例

    showBtn :class="{getInput:showBtn}"v-if="showBtn" showBtn: true, this.showBtn = ...

  7. Go mod graphql-go 的 Replace

    现在在项目中大量的使用 graphql,但用的版本是3年前的版本. 3年前包的url:github.com/neelance/graphql-go 现在的url:github.com/graph-go ...

  8. Django框架(七):模型(三) 关联、模型类的属性

    1. 关联 1.1 模型类关系 关系型数据库的关系包括三种类型: ForeignKey:一对多,将字段定义在多的一端中. ManyToManyField:多对多,将字段定义在任意一端中. OneToO ...

  9. Heavy Light Decomposition

    Note 1.DFS1 mark all the depth mark fathers mark the heavy/light children mark the size of each subt ...

  10. Python3 Windows服务器简单实现 手机访问

    设备 1. PC with Win10 2. Python 3.5.1 步骤 打开CMD,cd 到e盘,mkdir pythonWebserver 建立文件夹 //在E盘建立文件夹,作为服务器的根目录 ...