You are given a string representing an attendance record for a student.
The record only contains the following three characters:
'A' : Absent.
'L' : Late.
'P' : Present.
A student could be rewarded if his attendance record doesn't contain more than one 'A' (absent) or more than two continuous 'L' (late).
You need to return whether the student could be rewarded according to his attendance record.
Example 1:
Input: "PPALLP"
Output: True
Example 2:
Input: "PPALLL"
Output: False

bool checkRecord(string s) {
int a=, l=;
for(int i=;i<s.size();i++) {
if(s[i]=='A') a++;
if(s[i]=='L') l++;
else l=;
if(a>=||l>) return false;
}
return true;
}

最新文章

  1. gRPC C#学习
  2. 基于Nginx dyups模块的站点动态上下线并实现简单服务治理
  3. Hadoop: Hadoop Cluster配置文件
  4. ios视图frame和bounds的对比
  5. ecs CentOS 7 安装 mysql (mariadb)
  6. 几个最常用的git命令
  7. Back to Edit Distance(LCS + LIS)
  8. 回车键转tab键解决方案一
  9. Android_listView_BaseAdapter
  10. hibernate_validator_06
  11. IPTABLES封闭和开放端口
  12. iOS 8.0正式公布啦
  13. itextsharp生成pdf后的直接打印问题
  14. Tomcat初应用
  15. Bond UVA - 11354(LCA应用题)
  16. postgresql 定时任务备份及恢复
  17. centos7之zabbix3.2代理(zabbix-proxy)搭建
  18. 转:TCP为什么要3次握手和4次挥手时等待2MSL、 TCP如何保证消息顺序以及可靠性到达
  19. 【Unity】第10章 Mecanim动画系统
  20. MySQL慢日志简介及Anemometer工具介绍

热门文章

  1. Linux系统档案与文件系统的压缩与打包
  2. Git总结笔记3-把本地仓库推送到github
  3. javaweb之监听器详解
  4. Ajax,纯Js+Jquery
  5. Python beautifulsoup 中文乱码
  6. cocoapods安装和使用常见问题及解决方案
  7. nginx-tomcat-memcached架构文档说明(转)
  8. 【面向对象设计原则】之依赖倒置原则(DIP)
  9. 2017年最好的6个WEB前端开发手册下载
  10. Local模式下Spark程序只输出关键信息