题目描述

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. 吴裕雄--天生自然MySQL学习笔记:MySQL 函数

    ASCII(s) 返回字符串 s 的第一个字符的 ASCII 码. SELECT ASCII(CustomerName) AS NumCodeOfFirstChar FROM Customers; C ...

  2. MySQL性能管理及架构设计:第2章 什么影响了MySQL性能

    第2章 什么影响了MySQL性能 2-1 影响性能的几个方面 1.服务器的硬件 2.服务器的操作系统 3.数据库的存储引擎 4.数据库的参数配置 5.数据库表结构设计和SQL语句的编写和优化 2-2 ...

  3. Codeforces Round #620 (Div. 2)D dilworld定理

    题:https://codeforces.com/contest/1304/problem/D 题意:给定长度为n-1的只含’>'和‘<’的字符串,让你构造出俩个排列,俩个排列相邻的数字之 ...

  4. P1618 三连击(升级版)

    题解: #include<stdio.h>int main(){ int A,B,C; scanf("%d %d %d",&A,&B,&C);  ...

  5. 编写shell脚本,使用 nohup 让springboot 项目在后台持续运行

    1.将springboot项目打成jar放在linux的某个目录下. 2.新建一个nohup.log文件. 3.使用vi命令新建一个start.sh文件并写下以下内容: #!/bin/sh nohup ...

  6. Java学习笔记--精品札记

    forech循环增强版(JDK1.7新特性) for(数组单位元素类型 i:遍历目标数组){ 代码块 } char(只能放单个字符)数组可以直接遍历不需要循环,其他数组不可以,必须遍历 toStrin ...

  7. 刷题42. Trapping Rain Water

    一.题目说明 题目是42. Trapping Rain Water,翻译起来就是"接雨水".给n个非负正数代表高度,每个正数宽度为1,让计算能多少雨水.题目难度是Hard 二.我的 ...

  8. 吴裕雄--天生自然 JAVA开发学习:条件语句

    public class Test { public static void main(String args[]){ int x = 10; if( x < 20 ){ System.out. ...

  9. LeetCode Input Initial Code

    说明 LeetCode提供的样本输入,显示上是数组Array,而后台的实际测试用例则是树TreeNode,链表ListNode等. 如果你是在页面手撸代码直接提交的,那没什么影响. 如果你是在本地ID ...

  10. 整理平时常用git命令

    git常用命令 git创建分支 #创建本地分支并切换到新创建的分支 $ git checkout -b newbranch #将新创建的分支信息推送到github $ git push origin ...