Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1152. 단어의 개수 #9

Open
Dongsoon-Shin opened this issue Jan 10, 2023 · 2 comments
Open

1152. 단어의 개수 #9

Dongsoon-Shin opened this issue Jan 10, 2023 · 2 comments
Assignees
Labels
#문자열(string) 다양한 주제로 분류된 문제

Comments

@Dongsoon-Shin
Copy link
Contributor

Dongsoon-Shin commented Jan 10, 2023

https://www.acmicpc.net/problem/1152

Dongsoon-Shin pushed a commit that referenced this issue Jan 10, 2023
@Dongsoon-Shin Dongsoon-Shin added the #문자열(string) 다양한 주제로 분류된 문제 label Jan 10, 2023
@Dongsoon-Shin
Copy link
Contributor Author

Dongsoon-Shin commented Jan 10, 2023

use std::{io};
fn main() {
let mut guess = String::new();
io::stdin()
.read_line(&mut guess);
let s = guess
.split_ascii_whitespace();
let mut count = 0;
for c in s {
count = count + 1;
}
println!("{}", count);
}

언어는 rust 사용 해봤습니다.
단어를 white space 이용해서 split 하여 단어를 세는 프로그램 입니다.
내장 split_ascii_whitespace() 함수 이용하였습니다.
for loop를 돌면서 단어를 세고 출력합니다.

image

@Dongsoon-Shin Dongsoon-Shin self-assigned this Jan 10, 2023
@PositiveConfident
Copy link
Contributor

오오 이렇게 하는거군요! 고생하셨습니다!

lledellebell pushed a commit that referenced this issue Jan 12, 2023
lledellebell pushed a commit that referenced this issue Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#문자열(string) 다양한 주제로 분류된 문제
Projects
None yet
Development

No branches or pull requests

2 participants