PythonChallenge_第2题

点击题目链接
统计字符串中出现最少的字符

package PythonChallenge;

import java.io.PrintStream;
import java.util.Scanner;

class Level01{
    Scanner in=new Scanner(System.in);
    PrintStream out=System.out;
    Level01(){
    char[] str=in.nextLine().toCharArray();
     translation(str);
     out.println(str);
     char[] str1="map".toCharArray();
     translation(str1);
     out.println(str1);//ocr
    }

    void translation(char[] str){
        for(int i=0;i<str.length;++i){
            if(str[i]>='a' && str[i]<='x'){
                str[i]=(char) (str[i]+2);
            }else if(str[i]=='y'){
                str[i]='a';
            }else if(str[i]=='z'){
                str[i]='b';
            }
        }

    }

}
public class pychallenge01 {
    public static void main(String[] args) {
        new Level01();

    }
}

你可能感兴趣的:(java,py挑战)