This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| while read -s -n 1 char | |
| do | |
| echo $char | |
| done < $1 | sort | uniq | wc -l | awk '{print $1}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class String | |
| def count_the_number_of_words_in_a_string(word, pos = 0, num = 0) | |
| pos = self.index(word, pos) | |
| return num if pos == nil | |
| count_the_number_of_words_in_a_string(word, pos + 1, num + 1) | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class String | |
| def count_the_number_of_words_in_a_string(word) | |
| return self.split(/#{word}/).size - 1 | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #長さ制限つきのQueue | |
| class Q | |
| attr_accessor :q | |
| def initialize(size) | |
| @q = [] | |
| @size = size | |
| end |
NewerOlder