일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- Django Nodejs 차이점
- UI한글변경
- Django란
- 입출력 패턴
- correlation coefficient
- 이분그래프
- 입/출력
- k-eta
- EOF
- 매크로
- 알고리즘 공부방법
- 표준 입출력
- vscode
- getline
- scanf
- 연결요소
- string 메소드
- 시간복잡도
- 장고란
- 엑셀
- 백준
- 자료구조
- 구조체와 클래스의 공통점 및 차이점
- Django의 편의성
- 2557
- c++
- double ended queue
- 프레임워크와 라이브러리의 차이
- string 함수
- iOS14
Archives
- Today
- Total
Storage Gonie
(4) [C++, Java] 백준 No.2743 : 단어 길이 재기 본문
반응형
문제
풀이
# C++
#include <cstdio>
#include <cstring>
int main() {
char a[111];
scanf("%s",a);
printf("%d\n",strlen(a));
return 0;
}
#include <cstdio>
char s[111];
int main() {
scanf("%s",s);
int len = 0;
for (int i=0; s[i]; i++) {
len += 1;
}
printf("%d\n",len);
}
#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
cout << s.size() << '\n';
return 0;
}
# Java
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String s = sc.nextLine();
System.out.println(s.length());
}
}
반응형
'알고리즘 > 백준풀이5. 문자열' 카테고리의 다른 글
(6) [C++, Java] 백준 No.10824 : 네 수 (0) | 2019.04.25 |
---|---|
(5) [C++, Java] 백준 No.11655 : ROT13 (0) | 2019.04.25 |
(3) [C++, Java] 백준 No.10820 : 문자열 분석 (0) | 2019.04.25 |
(2) [C++, Java] 백준 No.10809 : 알파벳 찾기 (0) | 2019.04.25 |
(1) [C++, Java] 백준 No.10808 : 알파벳 개수 (0) | 2019.04.25 |
Comments