aboutsummaryrefslogtreecommitdiff
path: root/detect_capital.rs
diff options
context:
space:
mode:
Diffstat (limited to 'detect_capital.rs')
-rw-r--r--detect_capital.rs20
1 files changed, 0 insertions, 20 deletions
diff --git a/detect_capital.rs b/detect_capital.rs
deleted file mode 100644
index 454381d..0000000
--- a/detect_capital.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-struct Solution;
-
-impl Solution {
- pub fn detect_capital_use(word: String) -> bool {
- let v: Vec<char> = word.chars().collect();
- if v[0].is_lowercase() {
- return v.iter().all(|&c| c.is_lowercase());
- }
- if v.len() > 1 {
- let b = v[1].is_lowercase();
- return v.iter().skip(1).all(|&c| c.is_lowercase() == b);
- }
- true
- }
-}
-
-fn main() {
- let word = String::from("USA");
- print!("{}", Solution::detect_capital_use(word)); //true
-}