Issue metadata
Sign in to add a comment
|
Security:
Reported by
201329...@newton.k12.ma.us,
Sep 23
|
||||||||||||||||||
Issue description
There is a problem in google docs for word count. If you type a word and it is followed by a double space like so: Bob went to the beach and was tan. The program will count the double space as an extra word. Here is how to fix it:
var letters = Set<Character>()
for c in "abcdefghijklmnopqrstuvwxyz"{
letters.insert(c)
}
var b: Bool = true
let mydocument = "once upon a time !there was# a boy. "
var numberOfWords = 0
for c in mydocument {
if letters.contains(c) {
b = true
}
else {
if b {
numberOfWords += 1
}
b=false
}
}
print("there are \(numberOfWords) words in my document")
Good Luck
,
Jan 1
This bug has been closed for more than 14 weeks. Removing security view restrictions. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot |
|||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||
Comment 1 by mbarbe...@chromium.org
, Sep 24