// Copyright 2023 The Fuchsia Authors. All rights reserved. | |
// Use of this source code is governed by a BSD-style license that can be | |
// found in the LICENSE file. | |
pub fn reverse(input: &str) -> String { | |
input.chars().rev().collect::<String>() | |
} | |
#[cfg(test)] | |
mod test { | |
use super::*; | |
#[test] | |
fn test_reverse() { | |
assert_eq!(reverse("hello"), "olleh".to_string()); | |
assert_eq!(reverse("World"), "dlroW".to_string()); | |
} | |
} |