diff --git a/lab4/.idea/.gitignore b/lab4/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/lab4/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/lab4/.idea/lab4.iml b/lab4/.idea/lab4.iml
new file mode 100644
index 0000000..d6ebd48
--- /dev/null
+++ b/lab4/.idea/lab4.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lab4/.idea/modules.xml b/lab4/.idea/modules.xml
new file mode 100644
index 0000000..95bff7e
--- /dev/null
+++ b/lab4/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lab4/.idea/vcs.xml b/lab4/.idea/vcs.xml
new file mode 100644
index 0000000..6c0b863
--- /dev/null
+++ b/lab4/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lab5/lab5.pdf b/lab5/lab5.pdf
new file mode 100644
index 0000000..0bf3e3b
Binary files /dev/null and b/lab5/lab5.pdf differ
diff --git a/lab5/untitled/.idea/.gitignore b/lab5/untitled/.idea/.gitignore
new file mode 100644
index 0000000..13566b8
--- /dev/null
+++ b/lab5/untitled/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/lab5/untitled/.idea/misc.xml b/lab5/untitled/.idea/misc.xml
new file mode 100644
index 0000000..7464918
--- /dev/null
+++ b/lab5/untitled/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lab5/untitled/.idea/modules.xml b/lab5/untitled/.idea/modules.xml
new file mode 100644
index 0000000..3007dae
--- /dev/null
+++ b/lab5/untitled/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lab5/untitled/out/production/untitled/Letter.class b/lab5/untitled/out/production/untitled/Letter.class
new file mode 100644
index 0000000..02224ba
Binary files /dev/null and b/lab5/untitled/out/production/untitled/Letter.class differ
diff --git a/lab5/untitled/out/production/untitled/Main.class b/lab5/untitled/out/production/untitled/Main.class
new file mode 100644
index 0000000..559b63c
Binary files /dev/null and b/lab5/untitled/out/production/untitled/Main.class differ
diff --git a/lab5/untitled/out/production/untitled/Sentence.class b/lab5/untitled/out/production/untitled/Sentence.class
new file mode 100644
index 0000000..20f19a4
Binary files /dev/null and b/lab5/untitled/out/production/untitled/Sentence.class differ
diff --git a/lab5/untitled/out/production/untitled/Text.class b/lab5/untitled/out/production/untitled/Text.class
new file mode 100644
index 0000000..55a9d88
Binary files /dev/null and b/lab5/untitled/out/production/untitled/Text.class differ
diff --git a/lab5/untitled/out/production/untitled/TextProcessor.class b/lab5/untitled/out/production/untitled/TextProcessor.class
new file mode 100644
index 0000000..06f74d1
Binary files /dev/null and b/lab5/untitled/out/production/untitled/TextProcessor.class differ
diff --git a/lab5/untitled/out/production/untitled/Word.class b/lab5/untitled/out/production/untitled/Word.class
new file mode 100644
index 0000000..74f223f
Binary files /dev/null and b/lab5/untitled/out/production/untitled/Word.class differ
diff --git a/lab5/untitled/src/Main.java b/lab5/untitled/src/Main.java
new file mode 100644
index 0000000..555cc40
--- /dev/null
+++ b/lab5/untitled/src/Main.java
@@ -0,0 +1,166 @@
+import java.util.HashSet;
+
+public class Main {
+
+ public static void main(String[] args) {
+ String inputText = "Раз два три, літо прийди! По ООП сто балів захвати. ім'я запише без апострофу, ех"; //вход даних, текст
+ int targetLength = 3; //змінна, кількість літер в слові
+
+ try {
+ TextProcessor textProcessor = new TextProcessor();
+ HashSet uniqueWords = textProcessor.findUniqueWordsWithLength(inputText, targetLength);
+ System.out.println("Unique words of length " + targetLength + " in the input text are: " + uniqueWords);// вивод повідомлення, що містить довжину та унікальні слова змінної
+ } catch (Exception e) {
+ System.out.println("An error occurred: " + e.getMessage());//вивиод помилки
+ }
+ }
+}
+
+class Letter {
+ private char value;
+
+ public Letter(char value) {
+ this.value = value;
+ }
+
+ public char getValue() {
+ return value;
+ }
+
+ public void setValue(char value) {
+ this.value = value;
+ }
+}
+
+class Word {
+ private Letter[] letters;
+
+ public Word(Letter[] letters) {
+ this.letters = letters;
+ }
+
+ public Letter[] getLetters() {
+ return letters;
+ }
+
+ public void setLetters(Letter[] letters) {
+ this.letters = letters;
+ }
+
+ public int getLength() {
+ return letters.length;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ for (Letter letter : letters) {
+ sb.append(letter.getValue());
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+ Word other = (Word) obj;
+ return this.toString().equals(other.toString());
+ }
+
+ @Override
+ public int hashCode() {
+ return this.toString().hashCode();
+ }
+}
+
+class Sentence {
+ private Word[] words;
+ private String punctuation;
+
+ public Sentence(Word[] words, String punctuation) {
+ this.words = words;
+ this.punctuation = punctuation;
+ }
+
+ public Word[] getWords() {
+ return words;
+ }
+
+ public void setWords(Word[] words) {
+ this.words = words;
+ }
+
+ public String getPunctuation() {
+ return punctuation;
+ }
+
+ public void setPunctuation(String punctuation) {
+ this.punctuation = punctuation;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ for (Word word : words) {
+ sb.append(word.toString()).append(" ");
+ }
+ sb.append(punctuation);
+ return sb.toString();
+ }
+}
+
+class Text {
+ private Sentence[] sentences;
+
+ public Text(Sentence[] sentences) {
+ this.sentences = sentences;
+ }
+
+ public Sentence[] getSentences() {
+ return sentences;
+ }
+
+ public void setSentences(Sentence[] sentences) {
+ this.sentences = sentences;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ for (Sentence sentence : sentences) {
+ sb.append(sentence.toString());
+ }
+ return sb.toString();
+ }
+}
+
+class TextProcessor {
+ public HashSet findUniqueWordsWithLength(String inputText, int targetLength) {
+ HashSet uniqueWords = new HashSet<>();
+ String[] sentenceStrings = inputText.split("[?]");
+ for (String sentenceString : sentenceStrings) {
+ String[] wordStrings = sentenceString.trim().split("\\s+");
+ for (String wordString : wordStrings) {
+ wordString = wordString.replaceAll("[\\t\\s]+", " "); // Заміна послідовності табуляцій та пробілів одним пробілом
+ wordString = wordString.replaceAll("[^\\p{L}\\s]", ""); // Вилучення розділових знаків
+ wordString = wordString.toLowerCase(); // Перетворення на нижній регістр
+ wordString = wordString.replace("’", ""); // Вилучення апострофів
+
+ if (wordString.length() == targetLength) {
+ Letter[] letters = new Letter[wordString.length()];
+ for (int i = 0; i < wordString.length(); i++) {
+ letters[i] = new Letter(wordString.charAt(i));
+ }
+ Word word = new Word(letters);
+ uniqueWords.add(word);
+ }
+ }
+ }
+ return uniqueWords;
+ }
+}
diff --git a/lab5/untitled/untitled.iml b/lab5/untitled/untitled.iml
new file mode 100644
index 0000000..c90834f
--- /dev/null
+++ b/lab5/untitled/untitled.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file