Files

26 lines
665 B
Java
Raw Permalink Normal View History

2017-04-09 19:12:53 -05:00
// Author: Rodney Shaghoulian
2018-07-27 16:45:56 -07:00
// Github: github.com/RodneyShag
// HackerRank: hackerrank.com/RodneyShag
2017-04-09 19:12:53 -05:00
import java.util.Scanner;
public class Solution {
2017-09-11 09:32:17 -07:00
public static void main(String[] args) {
2017-04-09 19:12:53 -05:00
Scanner scan = new Scanner(System.in);
String str = scan.next();
scan.close();
System.out.println(alteredLetters(str));
}
private static int alteredLetters(String message) {
String sos = "SOS";
int count = 0;
for (int i = 0; i < message.length(); i++) {
if (message.charAt(i) != sos.charAt(i % 3)) {
count++;
}
}
return count;
}
}