blob: 82746d4714cff184e67e377650a6b16f7afae8d6 [file] [log] [blame] [edit]
// 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());
}
}