题目描述

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. 自己编写DLL并导出函数

    sub.c #include<windows.h> #include"sub.h" int WINAPI DllMain(_In_ HANDLE _HDllHandle ...

  2. M内核迎来大BOSS,ARM发布Cortex-M55配NPU Ethos-U55 ,带来无与伦比的性能提升

    说明: 全球顶级嵌入式会展Embedded Word2020这个月底就开了,各路厂家都将拿出看家本领. 先回顾下去年的消息: 1.去年年初的时候ARM发布Armv8.1-M架构,增加了Arm Heli ...

  3. nginx worker进程循环

    worker进程启动后,其首先会初始化自身运行所需要的环境,然后会进入一个循环,在该循环中不断检查是否有需要执行的事件,然后处理事件.在这个过程中,worker进程也是需要与master进程交互的,更 ...

  4. E. Double Elimination (DP)

    题目:传送门 题意:有 2^n 个人进行比赛,对他们编号 1~2^n,起初1和2打,3和4打,5和6打,7和8打...,然后1和2打完胜利的 和 3和4打完胜利的再打一场,1和2打完失败的和3和4打完 ...

  5. 寒假day13

    今天看了计算机网络的相关面试题

  6. Jmeter接口测试之案例实战

    Jmeter是apacheg公司基于Java开发的一款开源的压力测试工具,安装Jmeter之前先安装Jdk,具体JDK安装和环境变量配置自行百度.这里不概述. 1.添加线程组 测试计划->添加- ...

  7. python 2.7编译安装

    一 官网下载python2.7源码: python安装pip python -m ensurepip --default-pip

  8. nginx安装https证书

    安装证书 文件说明:1. 证书文件xxxxx.pem,包含两段内容,请不要删除任何一段内容.2. 如果是证书系统创建的CSR,还包含:证书私钥文件xxxx.key. ( 1 ) 在Nginx的安装目录 ...

  9. 题解 P1630 【求和】

    题目 发现题解都不够优雅,就自己来一篇 ( 以下除[代码]处代码,其余均为现场手打,如有误请与本蒟蒻联系 ) [分析] 首先,看清楚了,题目是 \(\sum_{i=1}^ai^b\) 的余数 ,而不是 ...

  10. 使用PHANTOMJS对网页截屏

    PhantomJS 是一个基于 WebKit 的服务器端 JavaScript API.它全面支持web而不需浏览器支持,其快速,原生支持各种Web标准: DOM 处理, CSS 选择器, JSON, ...