You saw how to find the first match and also return if there are no matches.
But what if you want to find out where the first match occurs? In our Alice in
Wonderland example, maybe we find the first long word and then find out how far
in that occurs to get some idea of how common long words really are. This is
where the program left off. How would you modify it to return the position of
the first long word? As well as that the long word was. Remember, the position
of the first word would be zero, and the position of the second word would be
one.
Vieron como encontrar la primer coincidencia y también la respuesta si no hay coincidencias.
Pero, ¿qué sucede si quieren encontrar donde ocurre la primer coincidencia? En nuestra ejemplo de «Alicia
en el País de las Maravillas», tal vez nos encontramos con la primera palabra larga y luego averiguamos qué tan dentro
ocurre para darnos una idea de que tan comunes son las palabras largas en realidad. Aquí es
donde el programa se detuvo. ¿Cómo lo modificarían para devolver la posición de la
primera palabra larga? Así como cual era la palabra larga. Recuerden, la posición
de la primera palabra sería cero y la posición de la segunda palabra sería
uno.
Vous avez vu comment trouver
la première correspondance
et comment renvoyer s'il n'y en a pas.
Mais si vous voulez savoir où se trouve
la première correspondance?
Dans notre exemple
d'Alice au pays des merveilles,
nous trouverons peut-être
le premier mot long
et verrons le nombre
de cas pour savoir
combien de fois les mots
longs apparaissent.
Voici où le programme
s'est arrêté.
Comment le modifieriez-vous pour
renvoyer la position du premier mot long
ainsi ce que le mot long était?
Pour rappel, la position
du premier mot serait 0
et la position du second mot serait 1.
最初の一致を見つける方法と
一致がない場合の処理について見てきました
では最初の一致が起きた場所を見つけたい場合は
どうなりますか?
「不思議の国のアリス」で
最初に出てくる長い単語と
それが表れた位置を探すことで
使用頻度を探ることができます
これはプログラムの途中の段階です
長い単語とその位置を返すためには
どのように変更しますか?
最初の単語の位置はゼロで
2番目の単語の位置は1となります
처음으로 나오는 무언가를 찾는것과 그 무언가가 나오지 않을 때 어떻게 해야 할지
보았습니다. 하지만, 처음에 나오는 무언가가 어디서 나오는지 알고 싶다면 어떻게 해야 할까요?
이상한 나라에서 온 엘리스 예를 보면, 첫 번째 긴 단어를 찾고 위치를 알아내서
얼마나 많이 그 단어가 나오는지 알 수 있습니다. 여기서 프로그램이
시작된 부분입니다. 처음으로 나오는 긴 단어의 위치를 리턴 하려면
어떻게 고쳐야 할까요? 첫 번째로 나오는 단어의 위치는 0이고
다음으로 나오는 단어의 위치는 1이라는 것을
기억해 주세요.