Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import javafx.beans.binding.StringBinding;
- public class CCheckTheText {
- public static void main(String[] args) throws IOException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- int numberOfWords = Integer.parseInt(reader.readLine());
- String words = reader.readLine();
- int numberOfLines = Integer.parseInt(reader.readLine());
- String input, result = "";
- boolean flag = false;
- for (int i = 0; i < numberOfLines; i++) {
- input = reader.readLine().toLowerCase();
- if ("capslock".equals(input)) {
- flag = !flag;
- continue;
- } else if ("backspace".equals(input)) {
- if (result.length() != 0) {
- result = result.substring(0, result.length() - 1);
- }
- continue;
- } else if ("space".equals(input)) {
- result += " ";
- continue;
- }
- if (flag) {// true capital
- result += input.toUpperCase();
- } else {// false small
- result += input.toLowerCase();
- }
- }
- System.out.println(words.equals(result) ? "Correct" : "Incorrect");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement