-
-
Save svracak/1909066 to your computer and use it in GitHub Desktop.
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
### Napišite metodu koja prima string i vraća broj pojavljivanja slova a u tom stringu | |
def vraca_slova(neki_string) | |
i=0 | |
neki_string.split(//).each do |x| | |
if(x == "a") | |
i=i+1 | |
end | |
end | |
puts i | |
end | |
vraca_slova(gets) | |
### Napišite metodu koja prima string a ispisuje ga unazad | |
def obratno(string) | |
puts string.reverse | |
end | |
obratno(gets) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment