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
2 Antworten
+ 1
What do you mean by "pairs"?
+ 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