Friday, November 24, 2017

Cryptographer's Conundrum Kattis Problem Solution In Java





//Nayeem Shahriar Joy,Applied Physics & Electronic Engineering, University of Rajshahi.
 

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import javax.swing.text.html.HTMLDocument.Iterator
 
public class Joy{
public static void main(String[] args) {
Scanner io = new Scanner(System.in);
String s=io.nextLine();
int count=0;
for(int i=0;i<s.length();i++) {
if(!((i%3==0&&s.charAt(i)=='P')||(i%3==1&&s.charAt(i)=='E')||(i%3==2&&s.charAt(i)=='R')))
{
count++;
}
}
System.out.println(count);
}
}

No comments:

Post a Comment