0

how to determine the number of pairs of a string separated by hyphens? example: "2-1-4-6-8-7" the number of pairs would be: 4

11th Dec 2018, 2:32 AM
Anthoni Hernandez
2 Réponses
+ 1
What do you mean by "pairs"?
11th Dec 2018, 2:49 AM
Ibaadi Jaya
Ibaadi Jaya - avatar
+ 1
If with “pairs” you mean even numbers... You can use the split method to split the string and then use the modulo operand to see if every number in the string is even or odd: https://code.sololearn.com/c7zofo00TPEF/?ref=app
11th Dec 2018, 10:15 AM
Sekiro
Sekiro - avatar