0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

初心者プログラマーAtCoderに挑んだ軌跡-ABC418-A-

Posted at

ABC418-A

問題の内容

文字列部分一致
与えられた文字列の最後3文字が事前条件の文字列に一致していれば特定の単語を返す。

言語

Rust

解法

文字列の操作で解く

課題

  • 最後の3文字の一致

学んだこと

  • s.ends_with("")で終わりを
  • s.starts_with("")で先頭を
  • s.contains("")は中に含まれてるか

提出内容

use proconio::input;

fn main() {
  input! {
    n: usize,
    s: String,
  }
  if s.ends_with("tea") {
    println!("Yes");
  } else {
    println!("No");
  }
}

成績

  • 173Byte
  • AC
  • 1ms
  • 1984KiB
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?