#K59657. Additional Employees Requirement
Additional Employees Requirement
Additional Employees Requirement
For successful event hosting, each event must have at least one host and one guest. You are given the number of employees and a log of past event participation. The log is a string in which 'H' denotes a host and 'G' denotes a guest. Your task is to determine the minimum number of additional employees required so that future events can be properly hosted. Specifically, if the log already contains both at least one 'H' and one 'G', no additional employees are needed. If only one type of role is present (and the log is non-empty), then exactly 1 additional employee is needed to cover the missing role. If the log is empty, both roles are missing, hence 2 additional employees are required.
In mathematical terms, let (H) be the indicator that a host is present and (G) the indicator that a guest is present. Then the answer is defined as: [ ans = \begin{cases} 0, & \text{if } H \land G \ 1, & \text{if } H \oplus G \ 2, & \text{if neither } H \text{ nor } G \text{ is present} \end{cases} ]
inputFormat
The input consists of two lines: The first line contains an integer (n) (which represents the number of employees, though it is not directly used in the calculation). The second line contains a string (log) representing the past participation (each character is either 'H' for host or 'G' for guest). The string may be empty.
outputFormat
Output a single integer which is the minimum number of additional employees needed.## sample
5
HHHHH
1