zoukankan      html  css  js  c++  java
  • Dispute (dispute)

    Description


    The (n) people line up in a line from left to right, and everyone faces either to the left or to the right.
    The relationship between these (n) individuals is not very harmonious, so if two adjacent people are standing face to face (the one on the left is facing the right and the person on the right is facing the left), then they will have a dispute, one of them Will drive another person out of the team.
    In each dispute, any two situations (the person on the left or the person on the right are kicked out of the team) may occur; and for multiple disputes that exist at the same time, they will occur in any possible order, but there will be no Two disputes occurred at the same time.
    Request the minimum possible value of the number of people left in the team when the team is stable, that is, when any two people will not have a dispute.

    Format


    Input

    The first line contains a positive integer (n), which represents the number of people.
    The second line contains a string of length (n), from left to right indicating the direction of each person, where "L" means facing left and "R" means facing right.

    Output

    Output an integer per line, which is the smallest possible value of the remaining number of people.

    Sample


    Input

    6
    LRRLRL
    

    Output

    2
    

    Sample Explanation

    One possible way to reach 2 people is LRRLRLLRLRLLRRLLRLLR.

    Hint


    Test point number (n) Agreement
    (1,2,3) (leq 10^6) None
    (4,5,6) (leq 3) All face the same
    (7,8,9,10) (leq 10^6) None

    Sample Code


    Code is not available!
    
  • 相关阅读:
    四、元数据ParameterMetaData
    三、PreparedStatement对象(重点)
    二、properties文件存储信息
    一、JDBC3.0标准中常用接口与类
    十一、MySQL 数据库存储引擎介绍
    十、执行计划
    注册表中一些项目拒绝访问,拒绝更改权限,拒绝删除
    x64dbg 的条件断点及断点日志
    手机APP无法抓包HTTPS解决方案
    原版黑苹果安装(个人备忘)
  • 原文地址:https://www.cnblogs.com/jiupinzhimaguan/p/13817597.html
Copyright © 2011-2022 走看看