leetcode520】的更多相关文章

Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of the following cases holds: All letters in this word are capitals, like "USA". All letters in t…
public class Solution { public bool DetectCapitalUse(string word) { var length = word.Length; ) { ; ; bool firstCapital = false; bool firstTime = true; foreach (var c in word) { if (char.IsUpper(c)) { UpCaseCount++; if (firstTime) { firstCapital = tr…