Revert "Delete lab3 directory"
This reverts commit 6fc3cc244e77162b6328c1d376936715adc59d0f.
This commit is contained in:
parent
6fc3cc244e
commit
31ba116ad8
8
lab3/OperationsStrings/.idea/.gitignore
generated
vendored
Normal file
8
lab3/OperationsStrings/.idea/.gitignore
generated
vendored
Normal file
@ -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
|
1
lab3/OperationsStrings/.idea/.name
generated
Normal file
1
lab3/OperationsStrings/.idea/.name
generated
Normal file
@ -0,0 +1 @@
|
||||
Main.java
|
6
lab3/OperationsStrings/.idea/misc.xml
generated
Normal file
6
lab3/OperationsStrings/.idea/misc.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="openjdk-19" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
lab3/OperationsStrings/.idea/modules.xml
generated
Normal file
8
lab3/OperationsStrings/.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/OperationsStrings.iml" filepath="$PROJECT_DIR$/OperationsStrings.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
11
lab3/OperationsStrings/OperationsStrings.iml
Normal file
11
lab3/OperationsStrings/OperationsStrings.iml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
Binary file not shown.
25
lab3/OperationsStrings/src/Main.java
Normal file
25
lab3/OperationsStrings/src/Main.java
Normal file
@ -0,0 +1,25 @@
|
||||
import java.util.HashSet;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String inputText = "Who are you? What is your name? Where are you from?";
|
||||
int targetLength = 3;
|
||||
|
||||
try {
|
||||
HashSet<String> uniqueWords = new HashSet<String>();
|
||||
String[] sentences = inputText.split("[?]");
|
||||
for (String sentence : sentences) {
|
||||
String[] words = sentence.trim().split("\\s+");
|
||||
for (String word : words) {
|
||||
if (word.length() == targetLength) {
|
||||
uniqueWords.add(word.toLowerCase());
|
||||
}
|
||||
}
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
BIN
lab3/lab3.pdf
Normal file
BIN
lab3/lab3.pdf
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user