diff options
Diffstat (limited to 'challenge-180/laurent-rosenfeld/python/ch-1.py')
| -rw-r--r-- | challenge-180/laurent-rosenfeld/python/ch-1.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/challenge-180/laurent-rosenfeld/python/ch-1.py b/challenge-180/laurent-rosenfeld/python/ch-1.py new file mode 100644 index 0000000000..254e6a04e5 --- /dev/null +++ b/challenge-180/laurent-rosenfeld/python/ch-1.py @@ -0,0 +1,9 @@ +"""Find the first unique character in the given string""" +for test in ["Perl Weekly Challenge", "Long Live Perl"]: + histo = dict() + for char in test: + histo[char] = histo.get(char, 0) + 1 + for i in range(0, len(test)): + if histo[test[i]] == 1: + print(test, ": ", i) + break |
