Unforunately for our lazy “heroes”, the nuts were planted by an evil bear known as… Dave, and they’ve fallen right into his trap. Dave is not just any bear, he’s a talking bear, but he can only understand sentences that are palindromes.
While Larry was dazed and confused, Ryan figured this out, but need a way to make sure his sentences are palindromic. So he pulled out his trustly iPod, which thankfully have this program you wrote just for this purpose… or did you?
Input
You’ll be given many sentences. You have to determine if they are palindromes or not, ignoring case and punctuations. Every sentence will only contain the letters A-Z, a-z, ‘.’, ‘,’, ‘!’, ‘?’. The end of input will be a line containing the word ‘DONE’, which should not be processed.
Output
On each input, output ‘You won’t be eaten!’ if it is a palindrome, and ‘Uh oh…’ if it is not a palindrome.
Sample Input
Madam, Im adam!
Roma tibi subito motibus ibit amor.
Me so hungry!
Si nummi immunis
DONE
Sample Output
You won’t be eaten!
You won’t be eaten!
Uh oh…
You won’t be eaten!

问题链接:UVA10945 Mother bear
问题简述:(略)
问题分析
    简单回文判定题不解释。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的C++语言程序如下:

/* UVA10945 Mother bear */#include <bits/stdc++.h>using namespace std;int main()
{string s;while(getline(cin, s)) {if(s == "DONE") break;int k = 0;for(int i = 0; s[i]; i++)if(isupper(s[i]))s[k++] = s[i] - 'A' + 'a';else if(islower(s[i]))s[k++] = s[i];// 判定回文int flag = 1, l = 0, r = k - 1;while(l < r)if(s[r] != s[l]) {flag = 0;break;} elsel++, r--;printf(flag ? "You won't be eaten!\n" : "Uh oh..\n");}return 0;
}

UVA10945 Mother bear【Ad Hoc】相关推荐

  1. Bailian4137 最小新整数【Ad Hoc】

    4137:最小新整数 总时间限制: 1000ms 内存限制: 65536kB 描述 给定一个十进制正整数n(0 < n < 1000000000),每个数位上数字均不为0.n的位数为m. ...

  2. Bailian4040 买书问题【Ad Hoc】

    4040:买书问题 总时间限制: 1000ms 内存限制: 65536kB 描述 某网上书店举行优惠促销,现有两种优惠策略.策略一是购书总额大于100元的可享受免费送货.策略二是如果购书数量大于3本, ...

  3. UVA11309 Counting Chaos【Ad Hoc】

    Wolfgang Puck's rival, Emeril Lagasse ("BAM!"), recently set the world culinary record in ...

  4. UVA11942 Lumberjack Sequencing【Ad Hoc】

    Another tale of lumberjacks?. Let see -     The lumberjacks are rude, bearded workers, while foremen ...

  5. UVA11764 Jumping Mario【Ad Hoc】

    Mario is in the final castle. He now needs to jump over few walls and then enter the Koopa's Chamber ...

  6. POJ3359 UVA1209 LA3173 Wordfish【Ad Hoc】

    Wordfish Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1082 Accepted: 535 Description Y ...

  7. POJ2940 HDU1489 UVA11054 Wine Trading in Gergovia【Ad Hoc】

    Wine Trading in Gergovia Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 3541   Accepte ...

  8. UVA10189 Minesweeper【Ad Hoc】

    Have you ever played Minesweeper? It's a cute little game which comes within a certain Operating Sys ...

  9. UVA344 UVALive5452 Roman Digititis【Ad Hoc】

    Many persons are familiar with the Roman numerals for relatively small numbers. The symbols "i& ...

最新文章

  1. 聊一聊跨域,Vue向Django请求数据的一些问题
  2. EndNote(二)之英文引文导入方式
  3. WIN下Nginx缓存加速配置方法
  4. simpledateformat 毫秒_阿里巴巴 | 为啥代码中禁用static修饰SimpleDateFormat?
  5. C#操作数据库,DataSet,DataGridView,更新数据库 [一] - ADO.NET入门之中
  6. 读书笔记:交易型系统设计的一般原则
  7. C语言三剑客之《C陷阱与缺陷》一书精华提炼
  8. iOS9适配(包括APNs)的改变
  9. mysql四种事务级别_【MySQL 知识】四种事务隔离级别
  10. anaconda tensorflow import PIL 报错的解决方法
  11. 如何判断数据库中是否已经存在某个临时表?
  12. Android 测试
  13. 生物信息分析员的编程小站
  14. MCS9865串口卡并口卡驱动
  15. 查看微信小程序的累计独立访客(UV)
  16. android室内地图,室内位置-与地图交互-开发指南-Android 室内地图SDK | 高德地图API...
  17. (已解决)vue数组添加数据后页面无法实时渲染
  18. 如何使用networkx导入txt文件数据并绘制
  19. 一文到胃------合并(归并)排序原理
  20. xbox one驱动下载_如何从手机将游戏下载到Xbox One

热门文章

  1. 2. 抓ARP包, 抓PPPoE包
  2. Vue-cli搭建vue基础项目
  3. 开源GIS(十三)——openlayers通过geoserver中WFS添加要素
  4. 如何让Toast响应点击事件等基础Android基础文章N篇
  5. DXUT框架剖析(14)
  6. 小程序报错:Error: errCode: -404011 cloud function execution error | errMsg: cloud.callFunction:fail req..
  7. mysql 支持全文搜索_MySQL全文本搜索:启用全文本搜索支持
  8. WinEdt10注册码
  9. Sqoop导入文件格式Text、Parquet、Avro、Sequence速度和大小的对比
  10. 集群之间数据拷贝distcp性能的调优