NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

/** Let me just start off by saying you wont understand any of my code, mainly because i dont either.
** my code is a mess of stuff everywhere
** enjoy!
**
** By: Harrison Crandall
**/
import java.util.*;
import java.text.*;
public class ASCL2 {
public static void main(String []args){ // Main Method
Scanner console = new Scanner(System.in); // Scanner Console
System.out.println("Input Line 1:"); /** INPUT LINE ONE **/ //EX: '(A B C D) '(E B A D C)
String input_1 = console.nextLine(); // Scanner Input
System.out.println("Input Line 2:"); /** INPUT LINE TWO **/ //EX: '(A A A A B C C A A C E E E E) '(A A A A B C C A A C E E E E)
String input_2 = console.nextLine(); // Scanner Input
System.out.println("Input Line 3:"); /** INPUT LINE THREE **/ //EX: '(A B C A A D E E E) '(A A A A B C C A A C E E E E)
String input_3 = console.nextLine(); // Scanner Input
System.out.println("Input Line 4:"); /** INPUT LINE FOUR **/ //EX: '((4 A) (1 B) (2 C) (2 A) (1 D) (4 E) 2) '((4 A) (1 B) (2 C) (2 A) (1 D) (4 E) 3)
String input_4 = console.nextLine(); // Scanner Input
System.out.println("Input Line 5:"); /** INPUT LINE FIVE **/ //EX: '((4 A) (1 B) (2 C) (2 A) (1 D) (4 E) 3) '((4 A) (1 B) (2 C) (2 A) (1 D) (4 E) 2)
String input_5 = console.nextLine(); // Scanner Input
System.out.println(input1(input_1)); /** PRINT LINE ONE **/
System.out.println(input2(input_2)); /** PRINT LINE TWO **/
System.out.println(input3(input_3)); /** PRINT LINE THREE **/
System.out.println(input4(input_4)); /** PRINT LINE FOUR **/
System.out.println(input5(input_5)); /** PRINT LINE FIVE **/
}
public static String input1(String input_1){
StringBuilder sb = new StringBuilder(input_1);
sb.deleteCharAt(sb.length() - 1);
sb.deleteCharAt(1);
sb.deleteCharAt(0);
String resultString = sb.toString();
String input1answer = ("'(" + Reverser(resultString) + ")");
return input1answer;
}
public static String input2(String input_2){
String input_2_nospace = input_2.replaceAll(" ","");
StringBuilder sb = new StringBuilder(input_2_nospace);
sb.deleteCharAt(sb.length() - 1);
sb.deleteCharAt(1);
sb.deleteCharAt(0);
String input_2_mod = sb.toString();
String input2answer = "'(" + ConsecutiveCounter2(input_2_mod) + ")";
return input2answer;
}
public static String input3(String input_3){
String input_3_nospace = input_3.replaceAll(" ","");
StringBuilder sb = new StringBuilder(input_3_nospace);
sb.deleteCharAt(sb.length() - 1);
sb.deleteCharAt(1);
sb.deleteCharAt(0);
String input_3_mod = sb.toString();
String input3answer = "'(" + ConsecutiveCounter3(input_3_mod) + ")";
return input3answer;
}
public static String input4(String input_4){
String input_4_nospace = input_4.replaceAll(" ","");
StringBuilder sb = new StringBuilder(input_4_nospace);
int remover;
sb.deleteCharAt(1);
sb.deleteCharAt(0);
String input4answer = Deleter(sb);
return input4answer;
}
public static String input5(String input_5){
String input_5_nospace = input_5.replaceAll(" ","");
StringBuilder sb = new StringBuilder(input_5_nospace);
sb.deleteCharAt(1);
sb.deleteCharAt(0);
String input5answer = expressionSplitter(sb);
return input5answer;
}

public static String Reverser(String input_1) { //CALCULATOR
int i, len = input_1.length(); //FOR
StringBuilder dest = new StringBuilder(len); //INPUT
for (i = (len - 1); i >= 0; i--){dest.append(input_1.charAt(i));} //LINE
return dest.toString();} //ONE
public static String ConsecutiveCounter2(String input_2){
String str; char ch; str = input_2; String input2return = "";
while(str.length()>0){ //CALCULATOR
ch = str.charAt(0); //FOR
int i=0; //INPUT
while(i < str.length() && str.charAt(i) == ch){i++;} //LINE
str = str.substring(i); //TWO
input2return = input2return + "(" + Integer.toString(i) + " " + Character.toString(ch) + ")" + " ";
}return input2return;}
public static String ConsecutiveCounter3(String input_3){
String str; char ch; str = input_3; String input2return = "";
while(str.length()>0){
ch = str.charAt(0);
int i=0; //CALCULATOR
while(i < str.length() && str.charAt(i) == ch){i++;} //FOR
str = str.substring(i); //INPUT
if (i == 1){ //LINE
input2return = input2return + Character.toString(ch) + " "; //THREE
} else{
input2return = input2return + "(" + Integer.toString(i) + " " + Character.toString(ch) + ")" + " ";
}
}return input2return;}
public static String Deleter(StringBuilder sb){
int x = Character.getNumericValue(sb.charAt(sb.length()-2));
int remove = x*x;
if (x==2){
for (int i = 1; i <= 3; i++){ //CALCULATOR
sb.delete(remove*i, (remove*i)+4); //FOR
} //INPUT
}else if (x==3){ //LINE
for (int i = 1; i<2; i++){ //FOUR
sb.delete(remove*i, (remove*i)+3);
sb.delete((remove*i)-1, (remove*i)+3);
}
}
String input4return = "'(" + sb.toString();
return input4return;}

public static String expressionSplitter(StringBuilder sb){
int x = Character.getNumericValue(sb.charAt(sb.length()-2)); //CALCULATOR
int moveOver = x*4; //FOR
sb.insert(moveOver, ")'("); //LINE
return "'" + sb.toString(); //FIVE
}
}
     
 
what is notes.io
 

Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 14 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.