PP_Zestaw5
Never
import java.util.*; public class Main { public static void main(String[] args) { System.out.println("Hello World"); zad3(); zad2(); zad1(); } public static void zad3() { int C = 0; int alfa = 0; int repeatedLetter = 2; char tmpCh = ' '; Scanner in = new Scanner(System.in); while(C<1 || C>50) { System.out.print("Podaj C z przedziału <1;50>: "); C = in.nextInt(); } C++; String[] text = new String[C]; String[] newText = new String[C]; for (int iC=0; iC<C; iC++) { text[iC] = in.nextLine(); newText[iC] = ""; } for (int iC=1; iC<C; iC++) { tmpCh=text[iC].charAt(0); text[iC] += " "; for (int i=0; i<text[iC].length(); i++) { if(tmpCh!=text[iC].charAt(i)) { if(alfa>repeatedLetter) { newText[iC]+=tmpCh+Integer.toString(alfa); } else { for (int j=0; j<alfa; j++) { newText[iC]+=tmpCh; } } tmpCh=text[iC].charAt(i); alfa=1; } else { alfa++; } } } for (int iC=1; iC<C; iC++) { if(newText[iC]!=null) { System.out.println(newText[iC]); } } } public static void zad2() { String text = "ABC DEF\nTERA EST ROTUNDAZ\nABCDEFGHIJKLMNOPQRSTUWXYZ"; String newText = ""; int nextL = 3; char[] chTab = new char[text.length()]; for (int i=0; i<text.length(); i++) { chTab[i] = text.charAt(i); } for(int i=0; i<text.length(); i++) { if((int)chTab[i]>=65 && (int)chTab[i]<=90) { if(((int)chTab[i]+nextL>90)) { chTab[i] = (char)(((int)chTab[i]+nextL)-(26+nextL)); } if(((int)chTab[i]+nextL<65)) { chTab[i] = (char)(((int)chTab[i]+nextL)+(26+(-1*nextL))); } chTab[i] = (char)((int)chTab[i]+nextL); newText += chTab[i]; } else { newText += chTab[i]; } } System.out.println(newText); } public static void zad1() { int t = 0; Scanner in = new Scanner(System.in); while(t<1 || t>1000) { System.out.print("Podaj t z przedziału <1;1000>: "); t = in.nextInt(); } t++; String[] text = new String[t]; for (int i=0; i<t; i++ ) { text[i] = in.nextLine(); } for (int i=0; i<t; i++ ) { for (int j=0; j<text[i].length()/2; j++) { System.out.print(text[i].charAt(j)); } System.out.print("\n"); } } }
Raw Text
-
Modern kitchen tiles
C | 1 min ago
-
Discover Top Wedding Venues near Delhi with CYJ for Your Dream Destination Wedding!
3 min ago
-
Html
HTML | 3 min ago
-
Backpacker Nata Ocean Opens Her Legs For BBC Roommate - HORNY HOSTEL
13 min ago
-
Untitled
27 min ago
-
https://twor.microsoftcrmportals.com/forums/support-forum/6653c3ea-9400-ef11-a73d-6045bd3fd1cb
36 min ago
-
t33ns gu
39 min ago
-
teens
42 min ago
-
My STEP-SISTER and I FUCKED during a walk in the WOODS!
46 min ago
-
Best Appetite Suppressant
48 min ago