当前位置:网站首页>7-2 h0107. Pig-Latin
7-2 h0107. Pig-Latin
2022-06-11 17:38:00 【Tomatoes_ Menon】
You have determined PGP Encryption is not powerful enough for your email . You have decided to convert clear text letters to Pig Latin, And then use PGP Encryption to complement it .
Input format :
You will write a program , The program will receive any number of text lines and Pig Latin Output . Each line of text will contain one or more words .“ word ” Is defined as a sequence of consecutive letters ( Capital and / Or lowercase ). Words should be converted to according to the following rules Pig Latin( Non words should be exactly the same as what appears in the input ):
A word that begins with a vowel (a、e、i、o or u, And their upper case versions ) Only strings should be appended `` ay ''( Exclude Quotes ). for example ,“ apple ” Turned into “ appleay ”.
Words that begin with consonants ( except A、a、E、e、I、i、O、o、U or u Any letter other than ) The first consonant should be deleted and appended to the end of the word , Then attach
ay'' It's also . for example ,hello'' become `` ellohay ''.Do not change the case of any letters .
Output format :
Enter... For each group , In a line with Pig Latin Output .
sample input :
This is the input.
sample output :
hisTay isay hetay inputay.#include<stdio.h>
int isletter(char a)
{
if (a >= 65 && a <= 90)
return 1;
else if (a >= 97 && a <= 122)
return 1;
return 0;
}
int isvowel(char c)
{
if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U')
{
return 1;
}
return 0;
}
char b[1024], t;
int main()
{
char a;
int i;
while (scanf("%c", &a)!=EOF)
{
if (isletter(a) == 1)
{
b[t++] = a;
}
else
{
if (t == 0) {
printf("%c", a);
continue;
}
if (isvowel(b[0]) == 1) {
for (i = 0; i < t; ++i) {
printf("%c", b[i]);
}
printf("ay%c", a);
}
else {
for (i = 1; i < t; ++i) {
printf("%c", b[i]);
}
printf("%cay%c", b[0], a);
}
t = 0;
}
}
return 0;
}
边栏推荐
- There are so many open source projects. This time, I'll show you the differences between different versions and understand the meaning of alpha version, beta version and RC version
- 6-6 批量求和(*)
- ffmpeg硬件编解码Nvidia GPU
- Mathematical basis of information security Chapter 2 - congruence
- Computing philosophy behind authoring
- 使用exe4j 将.jar文件打包为.exe文件
- ffmpeg硬编解码 Inter QSV
- Vscode configures eslint to automatically format with an error "the setting is deprecated. use editor.codeactionsonsave instead with a source“
- Merge K ascending linked lists ---2022/02/26
- From manufacturing to "intelligent manufacturing", explore the way for manufacturing enterprises to break the situation
猜你喜欢

送给大模型的「高考」卷:442人联名论文给大模型提出204个任务,谷歌领衔

How to become an optimist organization?

Sohu tout le personnel a été escroqué, quels problèmes ont été exposés?

What subclasses inherit, polymorphism, and upward transformation

【线上问题】Timeout waiting for connection from pool 问题排查

搜狐全员遭诈骗,暴露哪些问题?

合并两个有序链表---2022/02/24

拜登下令强制推行零信任架构
![[MySQL] detailed explanation of redo log, undo log and binlog (4)](/img/67/6e646040c1b941c270b3efff74e94d.png)
[MySQL] detailed explanation of redo log, undo log and binlog (4)

Semaphore PV operation of process interaction and its code implementation
随机推荐
Xie Yang, CEO of authing, was selected into Forbes' 30 under 30 Asia list in 2021
Authing biweekly news: online application market (5.10-5.22)
Semaphore PV operation of process interaction and its code implementation
6-5 统计单词数量(文件)(*)
04_ Feature engineering feature selection
Mathematical foundations of information security Chapter 3 - finite fields (I)
QLineEdit 设置输入掩码
MFSR:一种新的推荐系统多级模糊相似度量
TiDB-unsafe recover(tikv宕机数大于等于一半副本数)
Leetcode force deduction question
Chorus翻译
Hands on deep learning - multiple input and output channels in the convolution layer
tidb-gc相关问题
简单理解事件
05_特征工程—降维
6-2 多个整数的逆序输出-递归
TypeScipt基础
Summary of clustering methods
What subclasses inherit, polymorphism, and upward transformation
CentOS7服务器配置(四)---安装redis