We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Strings
- Mars Exploration
- Discussions
Mars Exploration
Mars Exploration
Sort by
recency
|
1028 Discussions
|
Please Login in order to post a comment
!/bin/python3
import math import os import random import re import sys
def marsExploration(s): count = 0 test = re.findall(r'\w\w\w',s) for x in test: if x != 'SOS': if x[0] != 'S': count = count + 1 if x[1] != 'O': count = count + 1 if x[2] != 'S': count = count + 1 return count
if name == 'main': fptr = open(os.environ['OUTPUT_PATH'], 'w')
*
!/bin/python3
import math import os import random import re import sys
def marsExploration(s): count = 0 test = re.findall(r'\w\w\w',s) for x in test: if x != 'SOS': if x[0] != 'S': count = count + 1 if x[1] != 'O': count = count + 1 if x[2] != 'S': count = count + 1 return count
if name == 'main': fptr = open(os.environ['OUTPUT_PATH'], 'w')
cpp solution without division, simply using an iterator for the comparing string :
R Solution