Skip to content

Commit

Permalink
문자열
Browse files Browse the repository at this point in the history
  • Loading branch information
KimJye committed Jul 30, 2018
1 parent 0b8aa4e commit ab9b1d4
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 0 deletions.
37 changes: 37 additions & 0 deletions string/p11655.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package baekjoon.string;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

//이상한 문자가 나옴...
public class p11655 {

public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
String str="";
int size;

StringBuffer sb = new StringBuffer();

while((str=buffer.readLine())!=null) {
size=str.length();

for(int i=0; i<size; ++i) {
char c = str.charAt(i);

if(c>=65 && c<=90)//대문자
c+=13;
else if(c>=97 && c<=122)//소문자
c+=13;
else
c-=13;
sb.append(c);
}

System.out.println(sb.toString());
}
}

}
18 changes: 18 additions & 0 deletions string/네수_p10824.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package baekjoon.string;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class ³×¼ö_p10824 {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub

BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String[] line = bf.readLine().split(" ");
String a = line[0] + line[1];
String b = line[2] + line[3];
long ans = Long.valueOf(a) + Long.valueOf(b);
System.out.println(ans);
}
}
14 changes: 14 additions & 0 deletions string/단어길이재기_p2743.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package baekjoon.string;

import java.util.Scanner;

public class ´Ü¾î±æÀÌÀç±â_p2743 {

public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
String str = input.nextLine();
System.out.println(str.length());
}

}
37 changes: 37 additions & 0 deletions string/문자열분석_p10820.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 문자열 N개가 주어진다.
* 이 때, 문자열에 포함되어 있는 소문자, 대문자, 숫자, 공백의 개수를 구하는 프로그램을 작성하시오.
* 각 문자열은 알파벳 소문자, 대문자, 숫자, 공백으로만 이루어져 있다.
*/
package baekjoon.string;

import java.io.*;

public class 문자열분석_p10820 {
public static void main(String[] args) throws IOException {
int lower, upper, num, split, size;

BufferedReader buffer = new BufferedReader(new InputStreamReader(System.in));
String words="";

while((words=buffer.readLine())!=null) {
lower=0;
upper=0;
num=0;
split=0;
size=words.length();

for(int i=0; i<size;++i) {
if(words.toCharArray()[i]==' ')
split++;
else if(words.toCharArray()[i]>=48 && words.toCharArray()[i]<=57)//숫자
num++;
else if(words.toCharArray()[i]>=65 && words.toCharArray()[i]<=90)//대문자
upper++;
else if(words.toCharArray()[i]>=97 && words.toCharArray()[i]<=122)//소문자
lower++;
}
System.out.println(lower+" "+ upper+" "+num+" "+split+ " ");
}
}
}
32 changes: 32 additions & 0 deletions string/알파벳개수_p10808.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* 알파벳 소문자로만 이루어진 단어 S가 주어진다.
* 각 알파벳이 단어에 몇 개가 포함되어 있는지 구하는 프로그램을 작성하시오.
* 단어에 포함되어 있는 a의 개수, b의 개수, …, z의 개수를 공백으로 구분해서 출력한다.
*/
package baekjoon.string;

import java.util.Scanner;

public class 알파벳개수_p10808 {

public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
String str = input.nextLine();
input.close();

int count=0;

for(int i=97; i<=122; ++i) {
for(int j=0; j<str.length();++j) {
if(str.charAt(j)==i) {
count++;
}else
continue;
}
System.out.print(count+" ");
count=0;
}
}

}
32 changes: 32 additions & 0 deletions string/알파벳찾기_p10809.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package baekjoon.string;

import java.util.Scanner;

public class ¾ËÆĺªÃ£±â_p10809 {

public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
String str = input.next();
input.close();

int[] arr = new int[26];
for(int i=0;i<26;++i) {
arr[i]=-1;
}

for(int i=0; i<str.length();++i) {
int index = str.charAt(i)-'a';

if(arr[index]==-1) {
arr[index]=i;
}
}

for(int i=0;i<26;++i)
{
System.out.print(arr[i]+" ");
}
}

}
25 changes: 25 additions & 0 deletions string/접미사배열_p11656.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package baekjoon.string;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Á¢¹Ì»ç¹è¿­_p11656 {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String str = bf.readLine();
int n = str.length();
String [] arr = new String[n];

for(int i=0;i<n;++i) {
arr[i]=str.substring(i);
}
Arrays.sort(arr);

for(int i=0; i<n; ++i) {
System.out.println(arr[i]);
}
}

}

0 comments on commit ab9b1d4

Please sign in to comment.