Đếm Kẻ Nói Dối
Bessie and her four friends are playing a guessing game. There are cows, numbered through . For each cow , the other cows know a bit of information: whether cow is a "truth-teller" (always tells the truth) or a "liar" (always lies). However, the cows themselves are unaware of this information.
The cows take turns making statements about each other. Each statement is of the form " is a truth-teller" or " is a liar". If a cow makes a statement, then one of the following is true:
- Cow is a truth-teller and the statement is correct
- Cow is a liar and the statement is incorrect
Given the statements and the actual types of the cows, determine the number of liars.
Dữ liệu vào
Dòng đầu tiên chứa một số nguyên ().
Dòng tiếp theo chứa ký tự, trong đó ký tự thứ là T nếu cow là kẻ nói dối, hoặc L nếu cow là người nói thật. Đợi, mình viết sai rồi. Hãy làm lại: ký tự thứ là L nếu cow là kẻ nói dối, hoặc T nếu cow là người nói thật.
Dữ liệu ra
In ra số lượng kẻ nói dối.
Ràng buộc
Ví dụ
| Input | Output | Giải thích |
|---|---|---|
3TLL |
2 |
Có 2 kẻ nói dối |
5TLLTL |
3 |
Có 3 kẻ nói dối |
Ghi chú
Đây là một bài toán đếm đơn giản. Bạn chỉ cần đếm số ký tự 'L' trong chuỗi.
Bình luận